Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bengut

macrumors newbie
Original poster
Jun 15, 2011
19
0
When a*user double clicks a document in the finder and the finder launches the preferred application to open this document, how does that preferred application get to know to handle this event.

I red the "launcheServicesConcepts" but I understand this is only for the case when I want to launch another application from within my own application

Can anyone help ?

cheers

bengut
 
According to the Open Operations section of the Launch Services Programming Guide (http://developer.apple.com/library/...tml#//apple_ref/doc/uid/TP30000999-CH202-SW14), your app be sent an odoc Apple event instructing it to open the specified document.

There's an NSApplicationDelegate method called application:openFile: (http://developer.apple.com/library/....html#//apple_ref/doc/uid/TP40008592-CH1-SW29). The docs don't say under what circumstances this delegate method is called, but perhaps try implementing it to just do an NSLog in order to see if it gets called.

If it doesn't get called, perhaps you might need to handle the Apple event yourself. But my gut says the Cocoa framework would be doing this for you.


EDIT: According to the Cocoa Scripting Guide (http://developer.apple.com/library/...AEs.html#//apple_ref/doc/uid/20001239-1119823), you should override application:openFiles: (http://developer.apple.com/library/....html#//apple_ref/doc/uid/TP40008592-CH1-SW37) in your app delegate. That's files plural, not file singular.
 
Last edited:
According to the Open Operations section of the Launch Services Programming Guide (http://developer.apple.com/library/...tml#//apple_ref/doc/uid/TP30000999-CH202-SW14), your app be sent an odoc Apple event instructing it to open the specified document.

There's an NSApplicationDelegate method called application:openFile: (http://developer.apple.com/library/....html#//apple_ref/doc/uid/TP40008592-CH1-SW29). The docs don't say under what circumstances this delegate method is called, but perhaps try implementing it to just do an NSLog in order to see if it gets called.

If it doesn't get called, perhaps you might need to handle the Apple event yourself. But my gut says the Cocoa framework would be doing this for you.


EDIT: According to the Cocoa Scripting Guide (http://developer.apple.com/library/...AEs.html#//apple_ref/doc/uid/20001239-1119823), you should override application:openFiles: (http://developer.apple.com/library/....html#//apple_ref/doc/uid/TP40008592-CH1-SW37) in your app delegate. That's files plural, not file singular.

Bingo jiminaus :)
I tried your proposal and implemented application:openFile: . First it wasn't called , but then I connected the Files Owner Outlet delegate to myAppController Class in Interface Builder and now the delegate is called. Just great . Now I have to verify the "filenames". By the way this is the 2nd time you helped me. I come back to you later. Regards from Berlin, Germany
 
Hi jiminaus, thanks again for your tip. It was a hit.
NSApplication calls its delegate "openFiles" and passes an Array of Strings with the dedicated filenames (full path). Then you can proceed to initiate those files.

There is another delegate called "applicationOpenUntitledFile". When you for instance click the app icon in the dock and there is no document open in your app, then NSApplication calls this delegate to open a new one.

regards from Berlin Germany
 
QTMovieCurrentSizeAttribute need help

Here is a passage of the QTMovie Class Reference about an attribute
-------------------------------------------------------
QTMovieCurrentSizeAttribute
The current size of a QTMovie object; the value for this key is of type NSValue, interpreted as an NSSize structure.
This attribute can be read and written. This attribute cannot be read or written when the movie has been initialized with QTMovieOpenForPlaybackAttribute set to YES. This attribute is deprecated in QTKit version 7.6 and later.
-------------------------------------------------------
Does anyone knows if there is a successor for this attribut.
Or how can one retrieve the current movie size when the window resizes and the movie view size grows or shrinks accordingly

bengut from Berlin
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.