I am trying to do the following task using a workflow. I have a workflow called get things done where I set my status in Microsoft Lync to Busy and would like to set the status back to 'Available' after some amount of time. I got this to work for setting my status to busy, however the delay causes me to no longer be able to use the hotkey to access alfred. It appears that alfred is blocked running the delay I added to my script. Anyone have a more standard way of doing this?
-- Save your current application
tell application "System Events"
set currentApp to name of 1st process whose frontmost is true
end tell
-- Bring Lync to the front so we can use the menu
tell application "Microsoft Lync"
activate
end tell
-- Set your status to 'Available'
tell application "System Events"
tell process "Microsoft Lync"
tell menu bar 1
tell menu bar item "Status"
tell menu "Status"
click menu item "Busy"
end tell
end tell
end tell
end tell
end tell
-- Return to your previous application
tell application currentApp
activate
end tell
delay 60 * 60
-- Save your current application
tell application "System Events"
set currentApp to name of 1st process whose frontmost is true
end tell
-- Bring Lync to the front so we can use the menu
tell application "Microsoft Lync"
activate
end tell
-- Set your status to 'Available'
tell application "System Events"
tell process "Microsoft Lync"
tell menu bar 1
tell menu bar item "Status"
tell menu "Status"
click menu item "Available"
end tell
end tell
end tell
end tell
end tell
-- Return to your previous application
tell application currentApp
activate
end tell