Hi all,
I have a question about handlers and if conditions. I hope you can help.
I have a handler with several if conditions in them and then more code after the statements.
At the moment if one of the if condition is true the rest of the script is not run/executed even after I have closed the if structure why is this?
example:
on OpenCard
if condition
then
do something
end if
if condition2
then
do something else
end if
##extra code to do other things below does not get executed if 1 condition is true. If I put it before the "if" all work. Just want to learn why it does not if put after. I hope this makes sense.
animations##not executing
launch web pages##not executing
end OpenCard
If then else in handlers *Q*
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: If then else in handlers *Q*
Hi istech,
it should work, unless "do something" or "do something else" somehow EXITs all remaining commands!
Could you please post these scripts or parts of them?
Best
Klaus
it should work, unless "do something" or "do something else" somehow EXITs all remaining commands!
Could you please post these scripts or parts of them?
Best
Klaus
Re: If then else in handlers *Q*
on opencard
## AutoReader
if the label of btn "RTM" is "ON"
then
RTMOn
end if
if the label of btn "RTM" is "OFF"
then
RTMOff
end if
## show image
wait for 2 seconds with messages## Could this be the problem
show image "MMLk" with visual effect dissolve## not executing
MakeMagic1## not executing
MakeMagic2## not executing
end opencard
## AutoReader
if the label of btn "RTM" is "ON"
then
RTMOn
end if
if the label of btn "RTM" is "OFF"
then
RTMOff
end if
## show image
wait for 2 seconds with messages## Could this be the problem
show image "MMLk" with visual effect dissolve## not executing
MakeMagic1## not executing
MakeMagic2## not executing
end opencard
Re: If then else in handlers *Q*
Hi istech,
come on, how shall I know what RTMon/off do?
Here a slightly more effective "if then":
And please use the new "visual effect" syntax, maybe that is also a problem:
...
lock screen for visual effect
show image "MMLk"
unlock screen with visual effect dissolve
...
WAIT should not be a problem at all here.
Best
Klaus
come on, how shall I know what RTMon/off do?

Here a slightly more effective "if then":
Code: Select all
...
if the label of btn "RTM" = "ON" then
RTMOn
ELSE
RTMOff
end if
...
...
lock screen for visual effect
show image "MMLk"
unlock screen with visual effect dissolve
...
WAIT should not be a problem at all here.
Best
Klaus
Re: If then else in handlers *Q*
Thanks Klaus -
Any help with the code is much appreciated and improvements/tips just throw them my way.
My script is not finished yet and this stopped working as I was testing. So I started to scratch my head
as in my head it should work.
I will restart and remove any extra code and post what is finished
and do some more digging thanks again Klaus....(and as I am typing this I found a bug in a server call)
Which I now fixed and it is working now.
That's 2 hours out of my life I can never get back.
Thanks again Klaus - Still always learning - I am getting there slowly.

Any help with the code is much appreciated and improvements/tips just throw them my way.

My script is not finished yet and this stopped working as I was testing. So I started to scratch my head
as in my head it should work.

and do some more digging thanks again Klaus....(and as I am typing this I found a bug in a server call)
Which I now fixed and it is working now.


Thanks again Klaus - Still always learning - I am getting there slowly.
