PDA

View Full Version : Pages autosave




lynkynpark86
Nov 22, 2010, 07:17 AM
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

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:



kainjow
Nov 22, 2010, 07:49 PM
Your script worked for me (Pages '08), but why not make it auto-save everything:

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 :)