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 > Invoke Address Book app's Window

Invoke Address Book app's Window
Thread Tools
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Mar 16, 2003, 09:45 PM
 
I've produced an Application that uses the Address Book database. I also have a button the users can click to open the Address Book application.

This button invokes the openURL command with the URL, "addressbook://".

This works well most of the time, however, if the Address Book application is already open, but it's window is closed or minimised, it's not of much use. The Address Book application is still brought to the front, but the window does not appear (remains closed/minimised). So it' s really quite useless in that situation. In fact the users sometimes don't even notice that the menubar has changed to Address Book.

I've tried using AppleScript events to activate address book, but that has the same result.

Is there any way I can activate the Address Book's window to either open it or un-minimise it?
     
Senior User
Join Date: Dec 2001
Status: Offline
Reply With Quote
Mar 16, 2003, 09:53 PM
 
In AppleScript, instead of using the keyword "activate", use the keyword "reopen". There is an AppleEvent code for "reopen", I just can't remember what it is offhand. So if you don't want the overhead of loading the AppleScript libraries in your application, you can use plain AppleEvents.
"Think Different. Like The Rest Of Us."

iBook G4/1.2GHz | 1.25GB | 60GB | Mac OS X 10.4.2
Athlon XP 2500+/1.83GHz | 1GB PC3200 | 120GB | Windows XP
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Mar 16, 2003, 10:06 PM
 
Excellent! That works for closed and minimised Address Book windows!

Just takes one line of Objective C code (plus 2 variable declarations).

Very neat.

Still need another line to bring it to the front (either "activate" or use the original URL method with "addressbook://").

Thanks for your help!
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Mar 16, 2003, 10:13 PM
 
Of course another solution is to invoke the URL:

"addressbook://<recID>?edit"

Where <recID> is the ID of an Address Book record. Of course, this isn't very helpful if you don't want to invoke edit mode in the Address Book.
     
   
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:54 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2