Skip to main content
edited body
Source Link
ruddfawcett
  • 1.9k
  • 2
  • 15
  • 31

Here is the AppleScript code, which you can put in your workflow, by implementing an AppleScript item, and copy-paste tgethe code in. The time is configurable, but you need an exact sleep time, which I can add if you could elaborate some more on the time. Here is the code via CulturedCode.

global quit_after, check_every

set quit_after to 2700
set check_every to 10
set minute to quit_after / 60

display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & minute & " minutesof system inactivity."

on reopen
    display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & minute & " minutes of system inactivity."
end reopen

on idle
    set idletime to do shell script "echo $((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000))"
    if (idletime as integer) > quit_after then
        tell application "System Events"
            if ((name of processes) contains "Safari") then
                tell application "Safari" to quit
            end if
        end tell
    end if
    return check_every
end idle

Here is the AppleScript code, which you can put in your workflow, by implementing an AppleScript item, and copy-paste tge code in. The time is configurable, but you need an exact sleep time, which I can add if you could elaborate some more on the time. Here is the code via CulturedCode.

global quit_after, check_every

set quit_after to 2700
set check_every to 10
set minute to quit_after / 60

display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & minute & " minutesof system inactivity."

on reopen
    display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & minute & " minutes of system inactivity."
end reopen

on idle
    set idletime to do shell script "echo $((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000))"
    if (idletime as integer) > quit_after then
        tell application "System Events"
            if ((name of processes) contains "Safari") then
                tell application "Safari" to quit
            end if
        end tell
    end if
    return check_every
end idle

Here is the AppleScript code, which you can put in your workflow, by implementing an AppleScript item, and copy-paste the code in. The time is configurable, but you need an exact sleep time, which I can add if you could elaborate some more on the time. Here is the code via CulturedCode.

global quit_after, check_every

set quit_after to 2700
set check_every to 10
set minute to quit_after / 60

display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & minute & " minutesof system inactivity."

on reopen
    display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & minute & " minutes of system inactivity."
end reopen

on idle
    set idletime to do shell script "echo $((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000))"
    if (idletime as integer) > quit_after then
        tell application "System Events"
            if ((name of processes) contains "Safari") then
                tell application "Safari" to quit
            end if
        end tell
    end if
    return check_every
end idle
added 43 characters in body
Source Link
ruddfawcett
  • 1.9k
  • 2
  • 15
  • 31

Here is the AppleScript code, which you can put in your workflow, by implementing an AppleScript item, and copy-paste tge code in. The time is configurable, but you need an exact sleep time, which I can add if you could elaborate some more on the time. Here is the code via CulturedCode.

global quit_after, check_every 

set quit_after to 900 2700
set check_every to 10
set minute to quit_after / 60

display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_afterminute & " seconds ofminutesof system inactivity." 

on reopen 
    display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_afterminute & " secondsminutes of system inactivity."  
end reopen 

on idle 
    set idletime to do shell script "echo $((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000))" 
    if (idletime as integer) > quit_after then 
        tell application "System Events" 
            if ((name of processes) contains "Safari") then 
                tell application "Safari" to quit 
            end if 
        end tell 
    end if 
    return check_every 
end idle

Here is the AppleScript code, which you can put in your workflow, by implementing an AppleScript item, and copy-paste tge code in. The time is configurable, but you need an exact sleep time, which I can add if you could elaborate some more on the time. Here is the code via CulturedCode.

global quit_after, check_every 

set quit_after to 900 
set check_every to 10 

display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_after & " seconds of system inactivity." 

on reopen 
display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_after & " seconds of system inactivity." end reopen 

on idle 
set idletime to do shell script "echo $((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000))" 
if (idletime as integer) > quit_after then 
tell application "System Events" 
if ((name of processes) contains "Safari") then 
tell application "Safari" to quit 
end if 
end tell 
end if 
return check_every 
end idle

Here is the AppleScript code, which you can put in your workflow, by implementing an AppleScript item, and copy-paste tge code in. The time is configurable, but you need an exact sleep time, which I can add if you could elaborate some more on the time. Here is the code via CulturedCode.

global quit_after, check_every

set quit_after to 2700
set check_every to 10
set minute to quit_after / 60

display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & minute & " minutesof system inactivity."

on reopen
    display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & minute & " minutes of system inactivity." 
end reopen

on idle
    set idletime to do shell script "echo $((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000))"
    if (idletime as integer) > quit_after then
        tell application "System Events"
            if ((name of processes) contains "Safari") then
                tell application "Safari" to quit
            end if
        end tell
    end if
    return check_every
end idle
added 64 characters in body
Source Link
ruddfawcett
  • 1.9k
  • 2
  • 15
  • 31

Here is the AppleScript code, which you can put in your workflow.., by implementing an AppleScript item, and copy-paste tge code in. The The time is configurable, but you need an exact sleep time, which I can add if you could elaborate some more on the time. Here is the code via CulturedCode.

global quit_after, check_every 

set quit_after to 900 
set check_every to 10 

display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_after & " seconds of system inactivity." 

on reopen 
display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_after & " seconds of system inactivity." end reopen 

on idle 
set idletime to do shell script "echo $((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000))" 
if (idletime as integer) > quit_after then 
tell application "System Events" 
if ((name of processes) contains "Safari") then 
tell application "Safari" to quit 
end if 
end tell 
end if 
return check_every 
end idle

Here is the AppleScript code, which you can put in your workflow... The time is configurable, but you need an exact sleep time, which I can add if you could elaborate some more on the time. Here is the code via CulturedCode.

global quit_after, check_every 

set quit_after to 900 
set check_every to 10 

display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_after & " seconds of system inactivity." 

on reopen 
display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_after & " seconds of system inactivity." end reopen 

on idle 
set idletime to do shell script "echo $((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000))" 
if (idletime as integer) > quit_after then 
tell application "System Events" 
if ((name of processes) contains "Safari") then 
tell application "Safari" to quit 
end if 
end tell 
end if 
return check_every 
end idle

Here is the AppleScript code, which you can put in your workflow, by implementing an AppleScript item, and copy-paste tge code in. The time is configurable, but you need an exact sleep time, which I can add if you could elaborate some more on the time. Here is the code via CulturedCode.

global quit_after, check_every 

set quit_after to 900 
set check_every to 10 

display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_after & " seconds of system inactivity." 

on reopen 
display dialog "Check is performed every " & check_every & " seconds. Things will be quit after " & quit_after & " seconds of system inactivity." end reopen 

on idle 
set idletime to do shell script "echo $((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000))" 
if (idletime as integer) > quit_after then 
tell application "System Events" 
if ((name of processes) contains "Safari") then 
tell application "Safari" to quit 
end if 
end tell 
end if 
return check_every 
end idle
Source Link
ruddfawcett
  • 1.9k
  • 2
  • 15
  • 31
Loading