Help with an IF statement please

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Nico
Newbie
Posts: 19
Joined: Tue Jul 08, 2008 3:15 pm

Post by Nico » Wed Jul 09, 2008 8:14 pm

MessageModal>Delay has to be between 10-200 seconds
ELSE
windowaction>1,Notepad
ENDIF
goto>solobot2
label>end

Label>solobot2
wait>2
press alt
Send>%dialog1.msEdit1%
release alt
press enter



I hope this is enough to solve my problem

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Jul 09, 2008 9:47 pm

I hope this is enough to solve my problem
You mean problem(s). There are several. I have commented the code to describe at the code locations what you need to do to fix your issues.
(The next part of the code is in the next post as the forum KEEPS deleting/editing my code -.- so weird)
To resolve this problem with the forum software, you need to locate and check the "Disable HTML in this post" check box located just below the message body box, before you pick the "Submit" button.

Hope this is helpful.

Code: Select all

//Notepad must be running for this script to work.

Let>comma=,
Dialog>dialog1
Caption=A little program
Width=445
Height=250
Top=204
Left=148
Max=1
Min=1
Close=0
Resize=0
Button=Start Bot,320,16,75,25,444
Label=Close Bot => Shift + Escape,288,48,true
Label=First Greet:,16,32,true
Edit=msEdit4,16,48,169,text here
Label=Second Greet:,16,80,true
Edit=msEdit5,16,96,169,text here
Label=Third Greet:,16,128,true
Edit=msEdit6,16,144,169,text here
Label=Delay,192,24,true
Edit=Delay1,192,48,25,1
Edit=Delay2,192,96,25,1
Edit=Delay3,192,144,25,1
EndDialog>dialog1

Label>MainLoop4
show>dialog1,result
If>result=444,StartBot
goto>MainLoop4

srt>StartBot
goto>solobot
end>StartBot

Label>solobot
///It doesn't matter what value you type in the dialog because you are
///setting the values in the next three lines.
///I remarked them out

//Let>dialog1.Delay1=10
//Let>dialog1.Delay2=10
//Let>dialog1.Delay3=15
Let>TotalDelay={%dialog1.Delay1%+%dialog1.Delay2%+%dialog1.Delay3%}
If>{(%TotalDelay% > 200) OR (%TotalDelay% < 10) }
MessageModal>Delay has to be between 10-200 seconds
ELSE
//add an asterisk to the window name unless you have the EXACT window name.
//"NotePad" is not an EXACT window name.
windowaction>1,Notepad*

//The way you were structured this next line would execute even if the
//"TotalDelay" test succeeded,  so I moved it into the "TotalDelay"
//test failed area.
goto>solobot2
ENDIF

//Move the label named "end" to the end and put in a Goto>end
Goto>end


Label>solobot2
SetFocus>NotePad*
wait>2

//Pressing and releasing "alt" is undesireable for sending text to notepad.
//I remarked them out
//press alt

//there is no "msedit1" so I changed this line to msedit4
Send>%dialog1.msedit4%
//release alt
press enter

label>end

Nico
Newbie
Posts: 19
Joined: Tue Jul 08, 2008 3:15 pm

Post by Nico » Fri Jul 11, 2008 7:45 pm

Works perfect :) Thank you so much for all your help!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts