Saturday, July 21, 2018
  • Index
  •  » Automator
  •  » writing an automator workflow for backing up the address book

#1 2005-08-01 01:23:56 pm

Trash Man
Sanitation Department
Registered: 2005-10-20
Posts: 5336

writing an automator workflow for backing up the address book

Hi,

I am trying to write an automator workflow to run the "Back up Address Book" command in address book (I was planning to just write an automator scipt, and have iCal run it every morning), but I seem to have a small problem:

So in the automator workflow, I first run the 'Launch Application" action, and select Address Book.  Then I selected the "Run Applescript" Action, and I used the following script: 

on run {input, parameters}
   
    tell application "System Events"
        tell process "Address Book"
            tell menu bar 1
                click menu item "Back up Address Book..." of menu "File"
            end tell
        end tell
    end tell
   
    return input
end run


I am able to 'close' the window, run the 'minimize' command from the window menu, and do other little things, but for some reason, the 'Back up Address Book' command does not work.  Please help!

am I typing in "Back up Address Book..." properly?


One mans trash is another mans treasure


Filed under: System

Offline

 

#2 2005-08-01 01:52:43 pm

jonn8
Member
From:: New York
Registered: 2003-05-01
Posts: 1766
Website

Re: writing an automator workflow for backing up the address book

The menu item uses an ellipsis character (Option-;), not three periods as you have used. The easiest way to have solved this was to use a command that gets the menu item names and then copy and paste. So, for instance, this would get the names of the menu items of the File menu:

Applescript:

tell application "Address Book" to activate
tell application "System Events"
   tell process "Address Book"
       tell menu bar 1
           return name of menu items of menu "File"
           -->{"New Card", "New Group", "New Group From Selection", "New Smart Group…", missing value, "Close", "Save", missing value, "Import", "Export vCard…", missing value, "Back up Address Book…", "Revert to Address Book Backup…", missing value, "Subscribe to Address Book…", missing value, "Send Updates…", missing value, "Print…"}
       end tell
   end tell
end tell

Then, copy and paste and you get:

Applescript:

tell application "Address Book" to activate
tell application "System Events"
   tell process "Address Book"
       tell menu bar 1
           click menu item "Back up Address Book…" of menu "File"
       end tell
   end tell
end tell

Jon


Filed under: System, address

Offline

 

#3 2005-08-01 02:19:39 pm

Trash Man
Sanitation Department
Registered: 2005-10-20
Posts: 5336

Re: writing an automator workflow for backing up the address book

Thanks for the reply!  I was able to follow your directions, and the scipt works uptil a point, but then the address book program wants me to click on the 'SAVE' button.  Is there a way to tell applescript to automatically select the SAVE option.  Also, can you recommend a good book (or website) so I can learn applescript commands?

Thanks!

-V-


One mans trash is another mans treasure

Offline

 

#4 2005-11-15 09:17:13 pm

celiawessen
Member
Registered: 2005-11-14
Posts: 3
Website

Re: writing an automator workflow for backing up the address book

Please take a look at the iCal database backup script. iCal and Address Book both have "Back up database", so your solution may be there.

http://bbs.applescript.net/viewtopic.php?id=14605

Offline

 
  • Index
  •  » Automator
  •  » writing an automator workflow for backing up the address book

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)