Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lynkynpark86

macrumors 6502
Original poster
Due do my recent loosing of 70+ pages of writing, I decided to write a script to autosave pages for me. It may look a little flawed (only saves one document at a time), but I have written this for my needs, exactly how I want it to work. Unfortunately, it gets an error every time
Code:
set xyz to text returned of (display dialog "Enter name of document to autosave" default answer "" buttons {"OK"} default button "OK")
set uptime to 0
repeat
	delay 60
	set uptime to uptime + 1
	if uptime ≥ 5 then
		tell application "Pages"
			save document xyz
			display alert "Autosaved"
		end tell
		set uptime to 0
	end if
end repeat
it says it "cannot get document (name of document typed) of application "pages"
please help me with this
:apple:
 
Your script worked for me (Pages '08), but why not make it auto-save everything:

Code:
set uptime to 0
repeat
    delay 60
    set uptime to uptime + 1
    if uptime ≥ 5 then
        tell application "Pages"
            repeat with doc in every document
                save doc
                display alert "Autosaved \"" & name of doc & "\""
            end repeat
        end tell
        set uptime to 0
    end if
end repeat

Or just get in the habit of hitting ⌘-s frequently :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.