I am trying to run a script after a certain period of user inactivity. Originally, I was going to use ScriptSaver http://www.versiontracker.com/dyn/moreinfo/macosx/16495, and this worked well on my laptop, but it does not work on the intel core duo iMac’s.
Is there another way to execute a script after a certain period of user inactivity?
A bug, Kai, a bug. I insert links with a little script which obviously needs to have its text item delimiters set to “” just in case they happen to be something else! I responded to this after working on a script in which the TIDs had been set to “.” and not set back after the script errored. Thanks for catching it.
The code looks like this:
-- This script starts with a URL in the clipboard and the link script that will show in the forum highlighted in a forum's text window.
-- It cuts the link script and forms a bbcode url from it. Be careful with spaces in the selection.
set AppleScript's text item delimiters to "" -- insurance
set theURL to the clipboard -- we're going to use the clipboard again!
tell application "Finder"
-- set visible of process "Script Editor" to false -- Needed if run is clicked in the Script Editor. If a compiled app is double-clicked put its name in place of "Script Editor" (no extension). Comment this line out if the script is run by a key command to a hotkey application like QuicKeys or FastScripts. I use FastScripts.
set Front_App to item 1 of (get name of processes whose frontmost is true) -- this should be the browser
end tell
tell application Front_App to activate -- necessary if you've just hidden the Script Editor or your script.app
tell application "System Events"
tell process Front_App
keystroke "x" using {command down} -- cut the link phrase.
keystroke "[url= & theURL & ]" -- stick in the bbcoded url.
keystroke (the clipboard) -- put the link text back.
keystroke "[/url]" -- close the bbcode
end tell
end tell