Help with an IF statement please
Moderators: Dorian (MJT support), JRL
Help with an IF statement please
I made a dialog with 3 edit boxes. What i want is, that if the value typed into the 3 boxes (if you lay them togehter) is bigger then 200 or smaller then 10 it wont start the macro, but show a message that its required to have a delay between 10-200
The first box has the value, 10, the second, 10, and the last 15 as default.
This is what i got so far, but i don't understand why it doesn't work?
Label>solobot
Let>dialog1.Delay1=10
Let>dialog1.Delay2=10
Let>dialog1.Delay3=15
If>{((%dialog1.Delay1%+%dialog1.Delay2%+%dialog1.Delay3%)>200)OR((%dialog1.Delay1%+%dialog1.Delay2%+%dialog1.Delay3%)Delay has to be between 10-200 seconds
Else
wait>2
press alt
Send>%dialog1.msEdit1%
release alt
Note: This is only a little part of my code.
The first box has the value, 10, the second, 10, and the last 15 as default.
This is what i got so far, but i don't understand why it doesn't work?
Label>solobot
Let>dialog1.Delay1=10
Let>dialog1.Delay2=10
Let>dialog1.Delay3=15
If>{((%dialog1.Delay1%+%dialog1.Delay2%+%dialog1.Delay3%)>200)OR((%dialog1.Delay1%+%dialog1.Delay2%+%dialog1.Delay3%)Delay has to be between 10-200 seconds
Else
wait>2
press alt
Send>%dialog1.msEdit1%
release alt
Note: This is only a little part of my code.
Last edited by Nico on Tue Jul 08, 2008 4:46 pm, edited 1 time in total.
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Re: Help with an IF statement please
If you want to multiply the three values why are you using "+" and not "*" in the If ?Nico wrote:3 boxes (if you multiply them) is bigger then 200 or smaller then 10
If>{((%dialog1.Delay1%+%dialog1.Delay2%+%dialog1.Delay3%)>200)OR((%dialog1.Delay1%+%dialog1.Delay2%+%dialog1.Delay3%)<10)}
When i do that i get the following errors:
Line:52 Operator opOr incompatible with String
And after that:
Line:52 Internal parser error. Code 10
My script:
Line 47: label>solobot
Line 48: Let>dialog1.Delay1=10
Line 49: Let>dialog1.Delay2=10
Line 50: Let>dialog1.Delay3=15
Line 51: Let>TotalDelay={%dialog1.Delay1%+%dialog1.Delay2%+%dialog1.Delay3%}
Line 52: If>{(%TotalDelay%>200)OR(%TotalDelay%)<10}
Line:52 Operator opOr incompatible with String
And after that:
Line:52 Internal parser error. Code 10
My script:
Line 47: label>solobot
Line 48: Let>dialog1.Delay1=10
Line 49: Let>dialog1.Delay2=10
Line 50: Let>dialog1.Delay3=15
Line 51: Let>TotalDelay={%dialog1.Delay1%+%dialog1.Delay2%+%dialog1.Delay3%}
Line 52: If>{(%TotalDelay%>200)OR(%TotalDelay%)<10}
For some strange reasons the forum deletes some of my post if i type line 52 too times in a row :S, very weird,
Anyway, i tried fixing line 52 and think i found a little misstype, i tried this:
If>{(%TotalDelay%)>200)OR(%TotalDelay%)<10}
The red part is my fix..
But when i run the script i get this error:
Line: 52) not appropriate
Any help?
Anyway, i tried fixing line 52 and think i found a little misstype, i tried this:
If>{(%TotalDelay%)>200)OR(%TotalDelay%)<10}
The red part is my fix..
But when i run the script i get this error:
Line: 52) not appropriate
Any help?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
That line should be:
If>{(%TotalDelay% > 200) OR (%TotalDelay% < 10) }
If>{(%TotalDelay% > 200) OR (%TotalDelay% < 10) }
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
No errors Thanks for the fast reply, its amazing how good support you give here..
But another problem appeared..
Label>solobot
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% Delay has to be between 10-200 seconds
Endif
windowaction>1,notepad
wait>2
press alt
Send>%dialog1.msEdit1%
release alt
So what i want this script to do is:
If the value is between 10-200 it opens Notepad, if not it shows the MDL
But when i run the script, nothing happens?
But another problem appeared..
Label>solobot
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% Delay has to be between 10-200 seconds
Endif
windowaction>1,notepad
wait>2
press alt
Send>%dialog1.msEdit1%
release alt
So what i want this script to do is:
If the value is between 10-200 it opens Notepad, if not it shows the MDL
But when i run the script, nothing happens?
When i run the script, if i choose the first delay to like 600, so the value is higher then 200 the notepad STILL opens. That's not what i want :/
If the value which is choosen is bigger then 200 or smaller den 10 a Messagemodal (MDL) Has to appear, but how do i do that? From the script i have right now, i don't see any errors
If the value which is choosen is bigger then 200 or smaller den 10 a Messagemodal (MDL) Has to appear, but how do i do that? From the script i have right now, i don't see any errors
Still doesn't work as i want it to, im getting tired of this problem
Here is my code, just copy it, and run it, and see for yourself, it doesn't work as it should do :/
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
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) }
(The next part of the code is in the next post as the forum KEEPS deleting/editing my code -.- so weird)
Here is my code, just copy it, and run it, and see for yourself, it doesn't work as it should do :/
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
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) }
(The next part of the code is in the next post as the forum KEEPS deleting/editing my code -.- so weird)
Last edited by Nico on Wed Jul 09, 2008 8:15 pm, edited 1 time in total.