• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to send myself an AppleEvent?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to send myself an AppleEvent?


  • Subject: Re: How to send myself an AppleEvent?
  • From: Pierre Bernard <email@hidden>
  • Date: Tue, 28 Feb 2006 16:03:12 +0100

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:
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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to send myself an AppleEvent?
      • From: Camillo Lugaresi <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>)

  • Prev by Date: Re: "bus error" when sending NSImages using distributed objects?
  • Next by Date: Re: Objective-C in a Time Constraint Thread
  • Previous by thread: Re: How to send myself an AppleEvent?
  • Next by thread: Re: How to send myself an AppleEvent?
  • Index(es):
    • Date
    • Thread