Use Geektool and Applescript to Get IOS Update Notifications

Posted by & filed under Uncategorized.


I made an applescript for making geektool alerts when there is an update to iPhone’s OS. It won’t work forever, but it will work for a while because it’s based on checking the apple website.

You’ll need to set up a text file somewhere on your computer with open permissions and you’ll need to change the path in the second line of code to list that file.

Then, you gotta save the applescript somewhere and tell geek tool to run it and display it on your desktop. When the title of the url changes, which I assume it will do when they update, it will notify you until geektool runs again. For this reason, I made geektool only run this script every 24 hours (86,000 seconds).

I know it’s probably not the most elegant way to code this, but I was surprised how difficult it was to find a way to be notified and I wanted to quickly throw something together.

tell application "Finder"
	set saver to (path to applications folder) & "AppleScript:ScotScripts:GeekTool:TitleCheckerSaver.txt" as text -- destination file
	set HTMLText to (do shell script "curl")
	set theTitleStart to (offset of "<title>" in HTMLText) + 7
	set theTitleEnd to (offset of "</title>" in HTMLText) - 1
	set theTitle to text theTitleStart thru theTitleEnd of HTMLText
	# if theTitle is different from the saver title, send a message then reset the saver
	set theChange to ""
	if exists file saver then
		set handle to open for access saver
		set old_title to (read handle for (get eof handle) as «class utf8»)
		close access handle
		if theTitle is not equal to old_title then
			set theChange to theTitle
			write theTitle to file saver as «class utf8»
		end if
		display alert "Your Title Checker File... " & saver & " ...doesn't exist" as informational
		return -- ends script
	end if
	return theChange
end tell

Leave a Reply