PDA

View Full Version : Help a newbie with an applescript for pages




ghostrider157
Jan 17, 2008, 10:56 AM
So I love the application pages with one exception. I hate that it doesn't have an autosave feature. Now I have managed to find a script that autosaves pages when it is open, but how do I add to that script to make the script terminate when pages closes. The code so far is:

repeat
delay 20
tell application "Pages" to save front document
beep
end repeat

and I have a program to open this app when pages launches, but i need help adding to the code to terminate the app when pages terminates.



xUKHCx
Jan 17, 2008, 11:02 AM
I don't have pages to test but I have inserted your bit of code into a script I use to run another application in a similar manner. What I do is save this as a application and call it PagesLaucnher or something like that and give it the same icon and then just use this in the dock to launch the pages app.


tell application "Pages" to activate

set apprunning to true

repeat until apprunning is false
tell application "System Events"
set myList to (name of every process)
end tell
if (myList contains "Pages") is false then
set apprunning to false
else
set apprunning to true
delay 20
tell application "Pages" to save front document
beep
end if
delay 6
end repeat

Eraserhead
Jan 18, 2008, 05:44 AM
every 6 seconds seems a bit frequent to autosave.

xUKHCx
Jan 18, 2008, 05:48 AM
every 6 seconds seems a bit frequent to autosave.

Well actually it is every 26 seconds and I merely cut and shunted their code into mine.

Eraserhead
Jan 18, 2008, 06:41 AM
Well actually it is every 26 seconds and I merely cut and shunted their code into mine.

So it is, I blame my iPod Touch which I was viewing the site on at the time.

MacGeek7
Apr 19, 2008, 07:14 PM
This is a very handy application - thanks for this