can't get Address Book GUI scripting to work

Hi,

Anybody any idea why the following doesn’t work for me ? (I have assistive device enabled). It runs, and even gets as far as repopulating the save as filename dialog box, but never presses ‘save’, just times out with a beep.

thanks

/Pete


tell application "Address Book" to activate

tell application "System Events"
	tell menu item "Back up Address Book." of menu "File" of menu bar 1 of application process "Address Book" to click
	delay 3
	keystroke "whatever filename"
	keystroke "d" using command down
	delay 1
	keystroke return
	delay 5
end tell

tell application "Address Book" to quit

Hi Pete,

keystroke return doesn’t work, use keystroke “s” using command down instead

activate application "Address Book"
tell application "System Events" to tell application process "Address Book"
	click menu item "Back up Address Book." of menu "File" of menu bar 1
	repeat until sheet 1 of window 1 exists
		delay 0.5
	end repeat
	keystroke "whatever filename"
	keystroke "d" using command down
	delay 1
	keystroke "s" using command down
	delay 1
end tell
quit application "Address Book"

Ahhh !

works perfect now - thanks !

One more question question - how to I get the name (full path) of the applescript that’s running ? - so that I can backup the script it’s self too…

thanks

/Pete

path to me → results an alias

Note: path to me doesn’t work, when the script will be run in Script Editor

work great thanks.