Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is there any way to force the App to run one of its menu options if there is no command line interface available?

Perhaps an Automation sort of thing?

EXAMPLE

I would like to run NewsFire's "File > Export Feeds" command to backup the feed list (OPML file). I tried running NewsFire through Terminal with "--help" but no luck.

Here is the backup script I currently use, in case anybody find it useful. It can be used to save and restore the state of NewsFire accross multiple machines (to restore you just cd ~ , and then unzip backup.zip).

#! /bin/bash
#
# Backup NewsFire preferences, feeds and cache (everything)
#

D_DESTFILE=~/Backups/Config/NewsFire.zip

# Don't update archive, create new one
if [ -e "$D_DESTFILE" ]; then
  rm $D_DESTFILE
fi

cd ~
zip -r $D_DESTFILE Library/Application\ Support/NewsFire Library/Caches/org.xlife.NewsFire Library/Preferences/org.xlife.NewsFire.plist
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

This is a beginning of an AppleScript to do the exporting:

set filename to "test file"

tell application "NetNewsWire" to activate
tell application "System Events"
    tell process "NetNewsWire"
        click menu item "Export Subscriptions…" of menu "File" of menu bar 1
        set value of first text field of first sheet of first window to filename
        click button "Save" of first sheet of first window
    end tell
end tell

tell application "NetNewsWire" to quit

It will save the exported file with the set filename at the location which was last used to do the exporting. It will not overwrite a currently existing file, so maybe you can save it in a temporary place and move it with a separate script.

Note: My copy of NetNewsWire had the menu command "Export Subscriptions…", not "Export Feeds", but if yours is different, just change the name of the menu item on line 6.

Edit to add: You also need to have "Enable access for assistive devices" in the Universal Access System Preference Panel set to enabled for this to work.

share|improve this answer
    
Awesome, thanks! –  faB Nov 14 '10 at 15:55
    
@faB: Hope it will be useful! =) –  Lizzan Nov 14 '10 at 15:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.