Page 1 of 1
button
Posted: Thu Feb 20, 2014 10:26 pm
by ferhan24badshah
How do I code a button so that after it is clicked once, it goes through the code embedded in that button...then it waits 5 seconds...then it goes through the code again without having to click the button again.
Re: button
Posted: Thu Feb 20, 2014 10:58 pm
by jmburnod
Salaam Ferhan,
I think you need use a send message in time to do it
Have a look to "send" command in dictionary
Best regards
Jean-Marc
Re: button
Posted: Thu Feb 20, 2014 11:22 pm
by ferhan24badshah
jmburnod wrote:Salaam Ferhan,
I think you need use a send message in time to do it
Have a look to "send" command in dictionary
Best regards
Jean-Marc
Was salaam
I tried using the send but it didnt seem to work...my code looks like this
this is button "Button"
on mouseUp
answer "hii"
send "mouseDown" to button "Button" in 5 seconds
end mouseUP
Re: button
Posted: Fri Feb 21, 2014 12:11 am
by Simon
Hi Ferhan,
on mouseUp
answer "hii"
send "mouseDown" to button "Button" in 5 seconds
end mouseUP
I'll quiz you on this one because finding things yourself is more fun.
What is the name of the command above?
What is the name of the command you wish to trigger after 5 seconds?
If you still need help just ask.
Simon
Re: button
Posted: Fri Feb 21, 2014 12:22 am
by ferhan24badshah
Simon wrote:Hi Ferhan,
on mouseUp
answer "hii"
send "mouseDown" to button "Button" in 5 seconds
end mouseUP
I'll quiz you on this one because finding things yourself is more fun.
What is the name of the command above?
What is the name of the command you wish to trigger after 5 seconds?
If you still need help just ask.
Simon
ohh i figured it out.....it should've been ....send "mouseUp" instead of send "mouseDown" =p , thanks.
Re: button
Posted: Fri Feb 21, 2014 1:21 am
by Simon

Glad you figured it out
To save your sanity you will want a way to break out of your loop so
Code: Select all
on mouseUp
answer "hii"
if the optionKey is up then --alt key on win
send "mouseUp" to me in 5 seconds --Note the "to me" as the command is in the button
end if
end mouseUp
Then there is the "pendingMessages" which you should look up with it's pal "cancel".
Code: Select all
global gCancel
on mouseUp
beep
send "mouseUp" to me in 5 second
put the result into gCancel
end mouseUp
and in the card script
Code: Select all
global gCancel
on optionKeyDown
cancel gCancel
end optionKeyDown
Note now you don't have to hold down the option key.
Simon