The following CScript causes TinyTERM to crash about 20 seconds after it completes. The script simply draws a window, then allows the user to pick a phone number from a list provided by a plain text data file. It then displays the selected phone number in the TinyTERM window:
// initialize variables
var numsites = 5; // change this value for the actual number of sites in the file
var site = dimstr(numsites);
var phonenum = dimstr(numsites);
var listfile = "QLClist.txt"; // change for actual list file
var tempstr,counter;
var chosen = -1;
var tempInt;
// read phone numbers from list file
fopen(1,listfile,"RA");
counter = 0;
while (counter < numsites)
{
tempstr = freadln(1,-1);
site[counter] = field(tempstr,1,_asc("="));
phonenum[counter] = field(tempstr,2,_asc("="));
counter++;
}
fclose(1);
// create listbox window
tsl_dlgopen( 76, -1, -1, 240, 320, 0, 0, 200, "Dialing List", "");
tsl_atobjinit();
counter = 0;
while (counter < numsites)
{
tsl_atobjaddlist(site[counter]);
counter++;
}
tsl_atobjdone(111,9,5,5,250,200,(0)|16385,"","",0,0,-1,"chosen", "");
tsl_atobjinit();
tsl_atobjdone(101,13,260,5,0,0,(258)|16384,"&Dial","",4,412,-1,"", "");
tsl_atobjinit();
tsl_atobjdone(102,13,260,35,0,0,(258)|16384,"Cancel","", 8,27,-1,"", "");
tsl_at_read( 0, "", 13);
tsl_wclose( 76);
tempInt = _asc(chosen) - _asc("0");
te.display(site[tempInt] + "\r\n");
te.display(phonenum[tempInt] + "\r\n");
return(0);
The bug is in the tsl_atobjinit(); command. It’s fixed in TinyTERM 4.53.
CR 772
This entry was posted
on Monday, April 23rd, 2007 at 1:47 pm and is filed under CScript.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.