I can’t seem to find this when I search, but I’m sure its a gimme.
I have a script that I want to run while another app (QXP) is running.
I have saved it as an application and checked the “Stay Open” checkbox, but it consistently times out.
property Idle_interval : 1
property WarnMe : false
on idle
tell application "System Events"
if exists application process "QuarkXPress" then
if WarnMe then
tell application "QuarkXPress"
beep
if exists document 1 then
if modified of document 1 is true then
set decision to the button returned of (display dialog "Shouldn't you save now?" buttons ¬
{"Yeah, do it", "Nah"} default button 2 giving up after 15 with icon note)
if decision = "Yeah, do it" then
tell document 1 of application "QuarkXPress"
save
end tell
end if
end if
end if
end tell
end if
set Idle_interval to 7 * minutes
set WarnMe to true
else
--tell me to display dialog "Quark is not running now..." default button 2 giving up after 5 with icon note
set Idle_interval to 1 * minutes
set WarnMe to false
end if
end tell
return Idle_interval -- in seconds
end idle