PDA

View Full Version : need help with error



Martin_SBT
02-06-2004, 07:43 AM
when project preview, when the following code is executing the 1st tme everything is fine but when executing a second time (that code is assigned to a refresh button) i am getting the following error: "attempt to index a string value". Please help, that is the last error i need to fix before publishing my app.




code is below:

Page.StartTimer(100);

Plugin.SetVisible("Plugin1", true);


--
File.Run("Bin\\acclist.BAT", insightsystem, "Bin", SW_MINIMIZE, true);
--
------------------------------------------------Parsing the text file

--
ParseTable ={}
txt_table2={}

--ParseFile="Siemens.txt"
--ParseFolder=_SourceFolder.."\\Autoplay\\Docs\\"
ParseText="LoginName"



ParseTable = TextFile.ReadToTable("Bin\\acclist.txt");
TableLines = Table.Count(ParseTable);
--
--

--Progress.SetStep("Plugin1", 10);

--

for count = 1, TableLines do


if (String.Find(ParseTable[count], ParseText, 1, false))~=(-1) then
count=count+1;
pass1 = ParseTable[count];
pass2 = String.TrimLeft(pass1, nil);
pass3 = String.Replace(pass2, "_VS =", "", false);
pass4 = String.Replace(pass3, "\\000", "", false);
pass5 = String.Replace(pass4, "\\\\", "\\", false);
pass6 = String.Replace(pass5, "\"", "", false);
pass7 = String.TrimLeft(pass6, nil);
--


--
if (pass7 ~= "SYSTEM")and(pass7 ~= "INSIGHT")then
result = ListBox.AddItem("Account List", pass7, "");
end
end

end
Page.StopTimer();

Progress.SetCurrentPos("Plugin1", 100);
Plugin.SetVisible("Plugin1", false);
Paragraph.SetVisible("Text5_initial", true);

Martin_SBT
02-06-2004, 10:42 AM
Anyone??

The problem is that there is no line number referenced in the error meaasge that pops up! If at least i had a way to get more details on the error such as which line is causing that error, that would be a good start.


thanks

Martin_SBT
02-06-2004, 11:21 AM
by using the debug trace feature it tell me that this is the line


if (String.Find(_ParseTable[count], ParseText, 1, false))~=(-1) then


that is causing the error!!! Just dont know what is wrong with it!!

Lorne
02-06-2004, 12:30 PM
Is the variable named _ParseTable or ParseTable? You used it both ways above...


if (String.Find(_ParseTable[count], ParseText, 1, false))~=(-1) then

I'm thinking you need this:


if (String.Find(ParseTable[count], ParseText, 1, false))~=(-1) then

Martin_SBT
02-06-2004, 12:36 PM
Hi Lorne

Noo it is just that after my 1st post above, i tried to change the name of the variable by adding an underscore cause stefan suspected that AMS had maybe a problem with some variable names. But it still doesnt work. I am really scratching my head with this problem!! I dont see what is wrong!

Martin_SBT
02-06-2004, 12:42 PM
arggggg! i found what it was! i used the same variable name for 2 different use, variable named "string" was causing that!!! I must put more attention on what variable names i am using!


thanks guys