Hi everyone! I'm extremely new to SCAR scripting and I decided to test my skills by making a completely working auto-login for his site (I'm only using it for my computer). I spent a long time scripting this entire thing, using it and then adding on more and more and more. Finally, I thought, why not make it about as good as possible (for me :P).
Here's what it's supposed to do:
Minimize everything (MinimizeAll),
Open Firefox (if it doesn't open then wait 1000 seconds) (OpenFireFox),
Type in the site in the search bar and make sure it doesn't give me a "page not found" error (if it does then wait 1000 seconds) (CheckIfSiteLoads),
Close the AD that tells you to vote when you get to the site (if it doesn't close, wait 1000 seconds) (CloseAd),
Scroll down, type in my username/password, press enter twice. (Login).
Here's the code:
SCAR Code:
program AutoAeroWebsiteLogin;
var
x,y: Integer;
const
MinimizeColor= 14145495;
ServerNotFoundColor= 15790320;
FireFoxColor= 10707259;
AeroStoryColor= 4276545;
Procedure MinimizeAll;
begin
if(FindColor(x,y,MinimizeColor,1356,9,1358,11)) then
begin
MoveMouse(1357,10);
ClickMouse(1357,10,true);
Wait(250);
end else
Writeln('Succesfully minimized all windows.');
Wait(50);
end;
Procedure OpenFireFox;
begin
MoveMouse(36,674);
ClickMouse(36,674,true);
Wait(50);
ClickMouse(36,674,true);
Wait(1000);
if(FindColor(x,y,FireFoxColor,35,673,37,675)) then
begin
Writeln('FireFox will not open. Please try again, or open FireFox and continue manually.');
Wait(1000000);
end else
Writeln('Succesfully opened Firefox.');
Wait(50);
end;
Procedure CheckIfSiteLoads;
begin
MoveMouse(259,64);
ClickMouse(259,64,true);
Wait(1000);
SendKeys('AeroStory.com'+chr(13));
Wait(5000);
if(FindColor(x,y,ServerNotFoundColor,699,599,701,601)) then
begin
Wait(1000000);
end else
Writeln('Successfully loaded AeroStory.com');
Wait(50);
end;
Procedure CloseAd;
begin
MoveMouse(828,532);
ClickMouse(828,532,true);
Wait(1000);
if(FindColor(x,y,AeroStoryColor,699,599,701,601)) then
begin
Writeln('Ad will not close. Please shut down script and try again, or manually close the add.');
Wait(1000000);
end else
Writeln('Ad closed.');
Wait(50);
end;
Procedure Login;
begin
MoveMouse(1435,250);
HoldMouse(1435,250,true);
Wait(50);
MoveMouse(1435,600);
ReleaseMouse(1435,600,true);
Wait(50);
MoveMouse(440,336);
ClickMouse(440,336,true);
Wait(500);
SendKeys('.'); //username here
Wait(500);
MoveMouse(439,379);
ClickMouse(439,379,true);
Wait(500);
SendKeys('.'); //password here
Wait(500);
SendKeys(chr(13));
Wait(1000);
SendKeys(chr(13));
end;
begin
MinimizeAll;
OpenFireFox;
CheckIfSiteLoads;
CloseAd;
Login;
end.
Edit: Okay I fixed my 1st problem, but now I have a new one 
Whenever I start it, it minimizes ONCE (it's supposed to keep minimizing until it gets to my desktop) and then keeps going on with the script. Another problem is, right here:
SCAR Code:
Procedure OpenFireFox;
begin
MoveMouse(36,674);
ClickMouse(36,674,true);
Wait(50);
ClickMouse(36,674,true);
Wait(1000);
if(FindColor(x,y,FireFoxColor,35,673,37,675)) then
begin
Writeln('FireFox will not open. Please try again, or open FireFox and continue manually.');
Wait(1000000);
end else
Writeln('Successfully opened Firefox.');
Wait(50);
end;
and in parts similar to that, it ignores that fact that it found a color it wasn't supposed to, and then DIDN'T wait the 1000000 miliseconds I asked for if it found that color. It also said "Successfully opened Firefox. Halp agains :3
PS: I am also trying to make it so if it finds the Firefox icon color after it double clicks Firefox (which means it didn't open), it will say "FireFox will not open. Please try again, or open FireFox and continue manually." in the debug and then stop the script.