Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > "keystroke return" intermittently working

"keystroke return" intermittently working
Thread Tools
rslifka
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Aug 15, 2006, 01:59 AM
 
Hi all,

Relatively simply little AppleScript here for backing up AddressBook. Only sometimes does the the backup dialog accept the "return" press as an actual return. The keystroke fileName works great, but then the background of the text becomes highlighted. So it seems like it's sometimes taking it as a literal ENTER character instead of the implicit "Save" click.

-- Bring iCal to the front
tell application "Address Book" to activate
delay 5

-- Click the "Backup" menu item
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

-- Enter the filename into the field
keystroke fileName
delay 1

-- Press ENTER to perform the backup
keystroke return
delay 5
end tell


Two ways to solve this:

(1) Figure out why this enter press isn't working OR

(2) Have the AppleScript click the Save button. I'd prefer this approach but cannot for the life of me figure out how it's done.

Any help is much, much appreciated. Thanks in advance =)

Rob
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 15, 2006, 02:09 AM
 
Take a look at this thread I found through Google. I think that's along the lines of what you're looking for.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
rslifka  (op)
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Aug 15, 2006, 02:14 AM
 
Hi Chuck,

Thanks very much for the quicky reply!

I've seen (and tried) those suggestions. Can't seem to find the button (I get AppleScript errors about not being able to turn it into a UI element, or the code just doesn't "find" it and does nothing).

Rob
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:51 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,