View Full Version : need help with error

02-06-2004, 06: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:


Plugin.SetVisible("Plugin1", true);

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

ParseTable ={}


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
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, "");


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

02-06-2004, 09:42 AM

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.


02-06-2004, 10: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!!

02-06-2004, 11:30 AM
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

02-06-2004, 11:36 AM
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!

02-06-2004, 11:42 AM
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