This code would be working if it is triggered and run as I switch the wall switch multiple times. But it seems like it waits for the first one to complete. Has anyone an idea how to do it?
Trigger is the switch.
- Code: Select all
if value of variable "SwitchLock" is equal to true then
set value of variable "Switch" to (value of variable "Switch") + 1
else
tell application "IndigoServer"
set value of variable "SwitchLock" to true
set value of variable "Switch" to 1
end tell
delay 0.5
if value of variable "Switch" is equal to 2 then
DO SOMETHING - 2 clicks
end if
if value of variable "Switch" is equal to 1 then
DO SOMETHING - 1 click1
end if
value of variable "Switch"
set value of variable "Switch" to 1
set value of variable "SwitchLock" to false
end if