I'm trying to use NSTimer as "delay" in AppleScript, in other words, I want to use NSTimer for only waiting.
on buttonClicked_(sender)
log "Button is clicked"
NSTimer's scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(60, me, "timerFired:", "Whatever", false) -- I want to make this line work like "delay 60"!
log "Finished"
end buttonClicked_
on timerFired_(theTimer)
log "Timer Fired"
end timerFired_
However, this code outputs following:
: Button is clicked
: Finished
: Timer Fired
This occurred because NSTimer starts but doesn't wait for a next operation.
on buttonClicked_(sender)
log "Button is clicked"
delay 60
log "Finished"
end buttonClicked_
on timerFired_(theTimer)
log "Timer Fired"
end timerFired_
After all, I want to substitute "delay" for "NSTimer" without changing the format.