Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Invalid Pointer HELP

Hello all,
I have my code all working yesterday (only made the spam cycle changes)

Today when I run my code:
It runs formcreate no problem
click button to start external prog. no problem --> login()
runs login() no problem -->MsgBrd();
runs through MsgBrd(); no problem -->Spam();
runs through Spam(); no problem -->Spam2();
runs through Spam2();

It sends the message AND clicks the minimize button
AS SOON as it clicks the minimize button I get an error:
[code]---------------------------
Debugger Exception Notification
---------------------------
Project OHproject1.exe raised exception class EInvalidPointer with message 'Invalid pointer operation'.
---------------------------
Break Continue Help
---------------------------
[/code]
when I select "break" I am looking at MsgBrd();....end;
any ideas what could be causing this?

here is the code from create to spam2..
formcreate
[code]
procedure Tcontrol_panel.FormCreate(Sender: TObject);
begin
if fileexists('./OH_BOT.ini') then
begin
inifile:=Tinifile.Create('./OH_BOT.ini');
lblusername.Caption:=inifile.ReadString('UserInfo','AccountName','')+ lblusername.caption ;
ediaccname.Text:=inifile.ReadString('UserInfo','Accountname','');
IniFile.Free;
end;
end;[/code]

start exe
[code]procedure Tcontrol_panel.ButstartClick(Sender: TObject);
begin
ShellExecute(Handle, 'open', 'magic1.exe', nil, 'C:Program FilesWizards of the CoastMagic Online', 10);
repeat coord:=AU3_pixelgetcolor (460,420);
sleep (500);
until
(coord=9802661);
AU3_WinSetState ('Magic Online V2.', '',SW_MAXIMIZE );
AU3_WinSetTitle ('','','MTGO Trade Bot v1.00');
//login section
Timedisconnect.Enabled:=True;
LogIn();
end;[/code]

login()
[code]procedure Tcontrol_panel.LogIn();
begin
Timedisconnect.Enabled:=True;
inifile:=Tinifile.Create('./OH_BOT.ini');
uname:=inifile.ReadString('UserInfo','Accountname','');
AU3_Send (uname,0);
sleep (500);
AU3_Send ('{TAB}',0);
AU3_Send (edipassword.Text,0);
sleep (500);
AU3_MouseClick ('left',500,440,1,5);
repeat coord:=AU3_pixelgetcolor (554,294);
sleep (1000);
if coord=13620438 then
begin
Sleep (500);
end
else if coord=6385269 then
begin
AU3_MouseClick ('left', 618,460,1,5);
Sleep (60000);
AU3_MouseClick ('left',500,440,1,5);
end
else if AU3_PixelGetColor (417,363)=65280 then
begin
LogIn();
end
until
(coord=13620438);
MsgBrd();
IniFile.Free;
end;[/code]

msgbrd()
[code]procedure Tcontrol_panel.MsgBrd();
begin
inifile:=Tinifile.Create('./OH_BOT.ini');
//Message Board - Buying
if inifile.ReadString('Messages','Buying','')='YES' then
begin
AU3_Send ('/join Message Board - Buying',0);
AU3_Send ('{ENTER}',0);
Sleep (1500);
repeat AU3_MouseClick ('left',400,167,1,5);
coord:=AU3_pixelgetcolor (400,167);
sleep (1000);
until
(coord=8224125);
AU3_MouseClick ('left',200,455,1,5);
buy:=inifile.ReadString('Spam','MessageBoard-Buyers','');
AU3_Send (buy,0);
Sleep (500);
AU3_Send ('{ENTER}',0);
Sleep (1000);
AU3_MouseClick ('left',744,150,1,10);
sleep (1500);
end
else if inifile.ReadString('Messages','Buying','')='NO' then
begin
sleep (1000);
end;
//Message Board - Selling
if inifile.ReadString('Messages','Selling','')='YES' then
begin
AU3_Send ('/join Message Board - Selling',0);
AU3_Send ('{ENTER}',0);
Sleep (1500);
repeat AU3_MouseClick ('left',400,167,1,5);
coord:=AU3_pixelgetcolor (400,167);
sleep (1000);
until
(coord=8224125);
AU3_MouseClick ('left',200,455,1,5);
sell:=inifile.ReadString('Spam','MessageBoard-Sellers','');
AU3_Send (sell,0);
Sleep (500);
AU3_Send ('{ENTER}',0);
Sleep (1000);
AU3_MouseClick ('left',744,150,1,10);
sleep (1500);
end
else if inifile.ReadString('Messages','Selling','')='NO' then
begin
Sleep (1000);
end;
Spam();
end;[/code]

spam()
[code]procedure Tcontrol_panel.Spam();
var
spam:string;
begin
inifile:=Tinifile.Create('./OH_BOT.ini');
spam:=inifile.ReadString('Spam','Room2Spam','');
if inifile.ReadString('Spam','DisableSpam','')='NO' then
begin
AU3_Send ('/join '+ spam,0);
AU3_Send ('{ENTER}',0);
repeat coord:=AU3_pixelgetcolor (684,149);
Sleep (1000);
until
(coord=14861701);
Sleep (1000);
Spam2();
end
else if inifile.ReadString('Spam','DisableSpam','')='YES' then
begin
Sleep (1000);
end;
IniFile.Free;
Timerpm.Enabled:=True;
TimerTrd.Enabled:=True;
end;[/code]

spam2()
[code]procedure Tcontrol_panel.Spam2();
var
time:string;
spamsg1:string;
begin
inifile:=Tinifile.Create('./OH_BOT.ini');
spamsg1:=inifile.ReadString('Spam','Message1','');
time:=inifile.ReadString('Spam','spamTime','');
if time='5' then
begin
AU3_Send (spamsg1,0); //[color=Red]sends message[/color]
Sleep (1000);
AU3_Send('{ENTER}', 0);
Sleep(1000);
AU3_MouseClick ('left', 684,149,1,3);//[color=Red]minimizes and send error[/color]
TimerSpam1.Enabled:=True;
end
else if time='10' then
begin
AU3_Send (spamsg1,0);
Sleep (1000);
AU3_Send('{ENTER}', 0);
Sleep(1000);
AU3_MouseClick ('left', 684,149,1,3);
TimerSpam2.Enabled:=True;
end
else if time='20' then
begin
AU3_Send (spamsg1,0);
Sleep (1000);
AU3_Send('{ENTER}', 0);
Sleep(1000);
AU3_MouseClick ('left', 684,149,1,3);
TimerSpam3.Enabled:=True;
end
else if time='30' then
begin
AU3_Send (spamsg1,0);
Sleep (1000);
AU3_Send('{ENTER}', 0);
Sleep(1000);
AU3_MouseClick ('left', 684,149,1,3);
TimerSpam4.Enabled:=True;
end
else if (time<>'5') OR (time<>'10') OR (time<>'20') OR (time<>'30') then
begin
AU3_Send (spamsg1,0);
Sleep (1000);
AU3_Send('{ENTER}', 0);
Sleep(1000);
AU3_MouseClick ('left', 684,149,1,3);
TimerSpam2.Enabled:=True;
end;
IniFile.Free;
Timerpm.Enabled:=True;
TimerTrd.Enabled:=True;
end;[/code]

timerspam1
[code]// 5 min spam cycle
const
GetPixelX: array[0..6] of integer = (280, 380, 480, 580, 680, 780, 880);
GetPixelY = 730;
var
SpamMsg: string;
SpamIndex, SpamBox: integer;
begin
inifile:=Tinifile.Create('./OH_BOT.ini');
repeat
coord := AU3_PixelGetColor (822,704);
Sleep(5000);
until (coord <> 9802661);

try
if (TimerSpam1.Tag < 1) or (TimerSpam1.Tag > 3) then
TimerSpam1.Tag := 2; // Safety to make sure that illegal values for the message index are filtered out.
SpamMsg:=inifile.ReadString('Spam','Message'+IntToStr(TimerSpam1.Tag),'');
for SpamIndex:= 0 to 6 do
begin
AU3_MouseMove(GetPixelX[SpamIndex], GetPixelY, 1);
Spambox:= AU3_PixelGetColor(GetPixelX[SpamIndex], GetPixelY);
if SpamBox <> 0 then
begin
AU3_MouseDown('left');
AU3_MouseClick('left', 137, 367, 1, 3);
Break;
end;
end;
Sleep(1000);
AU3_MouseClick('left', 140, 367, 1, 3);
AU3_Send (SpamMsg,0);
Sleep(1000);
AU3_Send('{ENTER}', 0);
Sleep(1000);
AU3_MouseClick ('left', 684,149,1,3);
finally
TimerSpam1.Tag := (TimerSpam1.Tag+1) mod 3+1;
inifile.Free;
end;
end;[/code]
Sign In or Register to comment.