SRL Archive - Other Scripts

Identifier expected????


g0tp0t

2010-03-26 19:36:17

this is my script. it connects my computer to a network named marge automatically when i disconnect. i am getting an 'identifier expected error. i checked and cant see any missing begin's or end's

[PHP]program New;
var x,y,i,n,t,marge,MargeFail:integer;notify:string;


function checkspinner(output:string): string;
begin
clickmouse(1275,789,true)
wait(700);
clickmouse(1159,790,true);
wait(700);
if findbitmap(MargeFail,x,y) then
begin
clickmouse(1249,527,true)
result := 'CF'
output := 'Connection failed! Retrying…'
wait(500);
end
else if findcolortolerance(x,y,15200093 ,1151,782,1163,793,100) then
begin
result := 'CO'
Output := 'Connection list opened'
end
else
begin
Result := 'CU'
Output := 'Connection status unknown!! :['



end;




begin
marge := BitmapFromString(30, 8, 'beNqtUjsShTAI9D6eJ1fwHFwj' +
'V7D1GpRapjRlStsI5EPei5l5M88dC1wXWMAYpwUNxn07KKBn3q4oW' +
'C0mZrJBiGCWw1iSuZXeTj9nvSceTpEUMmvQaUGOhVSEkkhB7csx+S' +
'GIpSooLdCJsmE+v2bPfSJ5A79/tVbDddKnyixL5i+A3yuP5m1iMpx' +
'yWd9VHm5DzzSszFZlKHCm99zsanDBevc/8LCEd8A/p+68wQ2okD7q' +
'');
MargeFail := BitmapFromString(243, 3, 'beNqlVcERxCAIvH7yTC3' +
'Wkq9t2EJasIU887WFtJCLRAUU1Llz8lAJy7Ii3vc7Trd/zHG+C+9h' +
'flnjFnfBFp3f++Y+W8D5WkzBrJXJ7+8iHMtjyiGYCcCT1xMa9wFt3' +
'W3ApfF0AlAu0y5jCuRJ2edNmtEIHNiWH5J0E2oo4SD3lWtLVaLI9I' +
'AwQc7EIGFV5NYL9bnsFhE6vqMT100SfzF6lchfOcbCS/hFTwQhVkF' +
'wAkXisgpp0JiJ4BMvuF92y0LFfyAFTkYaEyDaXRiDjwpbVkO7es1Z' +
'SAfRsKo5COF6IitasT9V306OqknlL0WfL+ypHEtPJrFKGfAWURV26' +
'TbsyJqugpSEhoNB6bWKyOn5EBqjlvskSG4XLn+J0gh8UNiyGmo49h' +
'RqUgCOqz7uJT27usgaw3vCt5Njtxgk/nNPzy85fgH20Z0U');

repeat
if findcolor(x,y,44543,1145,787,1160,793) then
begin //section a
clickmouse(x,y,true);
while not findbitmap(marge,x,y) do
begin //section a.a
wait(100);
i := i + 1;
if i = 600 then playsound(notify);;
end; //end section a.a
clickmouse(x,y,true);
wait(50)
clickmouse(x,y,true);
while not findcolor(x,y,16777215,1146,788,1150,792) do //loop a.l1
begin //a.li.a
wait(100);
t := t + 1;
CheckSpinner(output) //<— check to see if the network icon is loading/connecting
writeln(output); // with blue spinning wheel from vista and windows 7

if t = 6000 then
begin //a.li.b
writeln('fail!!');
//terminatescript;
wait(5000);
end; //end a.li.b
end; //end a.li.a

inc(n);
Writeln('success ' + inttostr(n));
end; //end section a
until false;
end.[/PHP]

Bonfield

2010-03-26 20:06:58

you were missing an end, read some tutorials about standards they make finding these errors alot easier, you also needed to add the var output i got it to compile

i know how frustrating it can get when you try to look through your code to find a simple error and can not find it =]

here it is

program New;

var
x, y, i, n, t, marge, MargeFail: integer;
notify, Output: string;

function checkspinner(output: string): string;
begin
clickmouse(1275, 789, true);
wait(700);
clickmouse(1159, 790, true);
wait(700);
if findbitmap(MargeFail, x, y) then
begin
clickmouse(1249, 527, true);
result := 'CF' output := 'Connection failed! Retrying...'
wait(500);
end else
if findcolortolerance(x, y, 15200093, 1151, 782, 1163, 793, 100) then
begin
result := 'CO' Output := 'Connection list opened'
end else
begin
Result := 'CU' Output := 'Connection status unknown!! :['
end;
end; // you were missing an end here


begin
marge := BitmapFromString(30, 8, 'beNqtUjsShTAI9D6eJ1fwHFwj' +
'V7D1GpRapjRlStsI5EPei5l5M88dC1wXWMAYpwUNxn07KKBn3q4oW' +
'C0mZrJBiGCWw1iSuZXeTj9nvSceTpEUMmvQaUGOhVSEkkhB7csx+S' +
'GIpSooLdCJsmE+v2bPfSJ5A79/tVbDddKnyixL5i+A3yuP5m1iMpx' +
'yWd9VHm5DzzSszFZlKHCm99zsanDBevc/8LCEd8A/p+68wQ2okD7q' +
'');

MargeFail := BitmapFromString(243, 3, 'beNqlVcERxCAIvH7yTC3' +
'Wkq9t2EJasIU887WFtJCLRAUU1Llz8lAJy7Ii3vc7Trd/zHG+C+9h' +
'flnjFnfBFp3f++Y+W8D5WkzBrJXJ7+8iHMtjyiGYCcCT1xMa9wFt3' +
'W3ApfF0AlAu0y5jCuRJ2edNmtEIHNiWH5J0E2oo4SD3lWtLVaLI9I' +
'AwQc7EIGFV5NYL9bnsFhE6vqMT100SfzF6lchfOcbCS/hFTwQhVkF' +
'wAkXisgpp0JiJ4BMvuF92y0LFfyAFTkYaEyDaXRiDjwpbVkO7es1Z' +
'SAfRsKo5COF6IitasT9V306OqknlL0WfL+ypHEtPJrFKGfAWURV26' +
'TbsyJqugpSEhoNB6bWKyOn5EBqjlvskSG4XLn+J0gh8UNiyGmo49h' +
'RqUgCOqz7uJT27usgaw3vCt5Njtxgk/nNPzy85fgH20Z0U');

repeat
if findcolor(x, y, 44543, 1145, 787, 1160, 793) then
begin //section a
clickmouse(x, y, true);
while not findbitmap(marge, x, y) do
begin //section a.a
wait(100);
i := i + 1;
if i = 600 then
playsound(notify);
end; //end section a.a
clickmouse(x, y, true);
wait(50) clickmouse(x, y, true);
while not findcolor(x, y, 16777215, 1146, 788, 1150, 792) do //loop a.l1
begin //a.li.a
wait(100);
t := t + 1;
CheckSpinner(output) //<--- check to see if the network icon is loading/connecting
writeln(output); // with blue spinning wheel from vista and windows 7
if t = 6000 then
begin //a.li.b
writeln('fail!!'); //terminatescript;
wait(5000);
end; //end a.li.b
end; //end a.li.a
inc(n);
Writeln('success ' + inttostr(n));
end; //end section a
until false;
end.

g0tp0t

2010-03-26 20:10:59

lol, yea, i do know standards. i just thought this would be a 10 liner :P but thanks, i layed with adding and removing ends but that never worked so i posted. it was the var ting i guess. when i added an end like u said, it wanted a colon at the last 'end;'… and that threw me off

thsnx a ton though

i luffs yeww

2010-03-26 20:11:57

With standards..


var
x, y, i, n, t, Marge, MargeFail: Integer;

function CheckSpinner: string;
begin
ClickMouse(1275, 789, True);
Wait(700);
ClickMouse(1159, 790, True);
Wait(700);
if FindBitmap(MargeFail, x, y) then
begin
ClickMouse(1249, 527, True);
Result := 'CF';
Writeln('Connection failed! Retrying...');
Wait(500);
end else
if FindColorTolerance(x, y, 15200093, 1151, 782, 1163, 793, 100) then
begin
Result := 'CO';
Writeln('Connection list opened');
end else
begin
Result := 'CU';
Writeln('Connection status unknown!! :[');
end;
end;

begin
Marge := BitmapFromString(30, 8, 'beNqtUjsShTAI9D6eJ1fwHFwj' +
'V7D1GpRapjRlStsI5EPei5l5M88dC1wXWMAYpwUNxn07KKBn3q4oW' +
'C0mZrJBiGCWw1iSuZXeTj9nvSceTpEUMmvQaUGOhVSEkkhB7csx+S' +
'GIpSooLdCJsmE+v2bPfSJ5A79/tVbDddKnyixL5i+A3yuP5m1iMpx' +
'yWd9VHm5DzzSszFZlKHCm99zsanDBevc/8LCEd8A/p+68wQ2okD7q' +
'');

MargeFail := BitmapFromString(243, 3, 'beNqlVcERxCAIvH7yTC3' +
'Wkq9t2EJasIU887WFtJCLRAUU1Llz8lAJy7Ii3vc7Trd/zHG+C+9h' +
'flnjFnfBFp3f++Y+W8D5WkzBrJXJ7+8iHMtjyiGYCcCT1xMa9wFt3' +
'W3ApfF0AlAu0y5jCuRJ2edNmtEIHNiWH5J0E2oo4SD3lWtLVaLI9I' +
'AwQc7EIGFV5NYL9bnsFhE6vqMT100SfzF6lchfOcbCS/hFTwQhVkF' +
'wAkXisgpp0JiJ4BMvuF92y0LFfyAFTkYaEyDaXRiDjwpbVkO7es1Z' +
'SAfRsKo5COF6IitasT9V306OqknlL0WfL+ypHEtPJrFKGfAWURV26' +
'TbsyJqugpSEhoNB6bWKyOn5EBqjlvskSG4XLn+J0gh8UNiyGmo49h' +
'RqUgCOqz7uJT27usgaw3vCt5Njtxgk/nNPzy85fgH20Z0U');

repeat
if FindColor(x, y, 44543, 1145, 787, 1160, 793) then
begin //section a
ClickMouse(x, y, True);
while not FindBitmap(Marge, x, y) do
begin //section a.a
Wait(100);
Inc(i);
if i = 600 then
PlaySound('C:/Windows/Media/Savanna/Windows Ding.wav');
end; //end section a.a
ClickMouse(x, y, True);
Wait(50);
ClickMouse(x, y, True);
while not FindColor(x, y, 16777215, 1146, 788, 1150, 792) do //loop a.l1
begin //a.li.a
Wait(100);
Inc(t);
CheckSpinner; //<--- check to see if the network icon is loading/connecting
// with blue spinning wheel from vista and windows 7
if t = 6000 then
begin //a.li.b
Writeln('Fail!');
//TerminateScript;
Wait(5000);
end; //end a.li.b
end; //end a.li.a
Inc(n);
Writeln('Success ' +IntToStr(n));
end; //end section a
until False;
end.