Simulating button pushes
Posted: Sat Nov 16, 2013 1:17 am
Hello,
I would like to simulate the pushing of a button. The button toggles the visibility of something and I would like on cardOpen for the button to act as if it being pressed at random incidents between 0.5 seconds and 2 seconds so that the thing it toggles(Line 4) automatically shows and hides at random intervals.
Here is the code for the button.
Thanks!
EDIT:
I made a start using this. It does work however it doesn't stop and I have to close Livecode to stop it. I also couldnt get the random intervals working.
I tried but i'm guessing that is incorrect.
I would like to simulate the pushing of a button. The button toggles the visibility of something and I would like on cardOpen for the button to act as if it being pressed at random incidents between 0.5 seconds and 2 seconds so that the thing it toggles(Line 4) automatically shows and hides at random intervals.
Here is the code for the button.
Code: Select all
on mouseUp
lock screen for visual effect
repeat with y = 1 to 27
put y into line y of temp
end repeat
sort temp by random(10000)
repeat with y = 1 to 27
set the points of graphic "Line 4" to the loc of graphic "tCircle4" & return & the loc of graphic ("tCircle" & line y of temp)
end repeat
if the visible of graphic "Line 4" is true then set the visible of graphic "Line 4" to false
else set the visible of graphic "Line 4" to true
unlock screen with visual effect dissolve very fast
end mouseUp
EDIT:
I made a start using this. It does work however it doesn't stop and I have to close Livecode to stop it. I also couldnt get the random intervals working.
I tried
Code: Select all
wait for random (500,2000) milliseconds
Code: Select all
repeat for 60 seconds
click button "1072" at the loc of card button ID"1072"
wait for 2 seconds
end repeat