 |
 |
finder toolbar 'touch' item
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2001
Status:
Offline
|
|
Im thinking of writing an app which lives in the finder tollbar and basically mimics the 'new folder' toolbar item, but rather than create a folder, it makes a new blank document in the selected directory named 'untitled file' and selects the name ready for editing. How do i ask the finder what file/folder is currently selected in obj c/cocoa? Do I even want to do this with cocoa? Do I need to learn applescript?
|
3R1C
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
If you ask me, this is definitely a job for AppleScript. You'd have to use osascript (a command-line AppleScript runner) to talk to the Finder in straight Cocoa anyway.
<small>[ 07-25-2002, 03:43 AM: Message edited by: Chuckit ]</small>
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Sep 2000
Location: Springfield, MA
Status:
Offline
|
|
Make sure you have it update the modified date of selected files too. It can't be called touch if it doesn't do that.
|
|
We hope your rules and wisdom choke you / Now we are one in everlasting peace
-- Radiohead, Exit Music (for a film)
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
Sounds lke something better off written as an AppleScript applet in Script Editor.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Chuckit:
<strong>If you ask me, this is definitely a job for AppleScript. You'd have to use osascript (a command-line AppleScript runner) to talk to the Finder in straight Cocoa anyway.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Well no, that's what some people would do, but it would be better to use the OSA APIs to execute your script. Or use AppleEvents directly. Or use the free Obj-C wrappers for AppleScript.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2001
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif"> Or use AppleEvents directly. </font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">That sounds like the way to go to me.
I'll look into this.
|
3R1C
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Angus_D:
<strong> </font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Chuckit:
<strong>If you ask me, this is definitely a job for AppleScript. You'd have to use osascript (a command-line AppleScript runner) to talk to the Finder in straight Cocoa anyway.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Well no, that's what some people would do, but it would be better to use the OSA APIs to execute your script. Or use AppleEvents directly. Or use the free Obj-C wrappers for AppleScript.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">I haven't heard of any way to send AppleEvents directly from Cocoa. The information I'd gotten on the subject indicates that Cocoa apps are cut off from using that functionality directly. Am I misinformed?
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif"> I haven't heard of any way to send AppleEvents directly from Cocoa. The information I'd gotten on the subject indicates that Cocoa apps are cut off from using that functionality directly. Am I misinformed? </font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Cocoa.framework links ApplicationServices.framework, which includes AE.framework where all the AppleEvent stuff lives. The headers are already imported if you've imported <AppKit/AppKit.h>, so you can use any AppleEvent-related functions there. (Also, you can use any of the stuff in OpenScripting.framework for higher-level scripting functions.)
Just because something doesn't have ObjC APIs in AppKit or Foundation doesn't mean you can't use it from Cocoa.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Rickster:
<strong> </font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif"> I haven't heard of any way to send AppleEvents directly from Cocoa. The information I'd gotten on the subject indicates that Cocoa apps are cut off from using that functionality directly. Am I misinformed? </font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Cocoa.framework links ApplicationServices.framework, which includes AE.framework where all the AppleEvent stuff lives. The headers are already imported if you've imported <AppKit/AppKit.h>, so you can use any AppleEvent-related functions there. (Also, you can use any of the stuff in OpenScripting.framework for higher-level scripting functions.)
Just because something doesn't have ObjC APIs in AppKit or Foundation doesn't mean you can't use it from Cocoa.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif"><img border="0" alt="[Hmmm]" title="" src="graemlins/hmmm.gif" /> Nah, I realize that. I've made a few Cocoa apps that relied heavily on ApplicationServices.framework myself.
It's just that I've been told a couple of times that the AppleEvents parts wouldn't work right with Cocoa. Probably should've looked into it more, but I suppose I'm just too trusting sometimes.
Anyway, my bad. Thanks for the correction.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|