Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to send myself an AppleEvent?



Mike,

thanks for your reply. I might investigate the AppleScript route.

I'd rather send my app the very same event it receives upon a click on the Dock rather than recreating the desired behavior myself.

Pierre

On Feb 28, 2006, at 10:56 AM, Mike Abdullah wrote:

It would probably be easier just to use a small NSAppleScript and execute that. try something like:

	activate application "myApp"

Where myApp is the name of your application. However | am slightly confused as to what else you want. Are you basically trying to simulate the act of the user clicking on the dock icon for your app? If so, and you want to open a new doc, simply do something like this after running the script:

if ([[[NSDocumentController sharedDocumentController] documents] count] == 0)
[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay: YES error: nil]


openUntitledDocAndDisplay is only available in 10.4, but there is a 10.3 and earlier equivalent.

Mike.

On 27 Feb 2006, at 18:07, Pierre Bernard wrote:

Hi!

I want my application to send itself an AppleEvent.

Specifically I have a document based application that I want to send a reopen event so it becomes active and creates a new document as needed.

I came across some Carbon functions and one hardly documented Cocoa method. Nothing I can make much sense of. Yet I figure sending an AppleEvent ought to be something easy.

TIA for your help
Pierre _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mike.abdullah% 40gmail.com


This email sent to email@hidden


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >How to send myself an AppleEvent? (From: Pierre Bernard <email@hidden>)
 >Re: How to send myself an AppleEvent? (From: Mike Abdullah <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.