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 > finder toolbar 'touch' item

finder toolbar 'touch' item
Thread Tools
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Jul 24, 2002, 11:32 PM
 
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
Reply With Quote
Jul 25, 2002, 02:29 AM
 
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
Reply With Quote
Jul 25, 2002, 04:12 AM
 
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
Reply With Quote
Jul 25, 2002, 03:07 PM
 
Sounds lke something better off written as an AppleScript applet in Script Editor.
Rick Roe
icons.cx | weblog
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jul 25, 2002, 05:44 PM
 
</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.
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Jul 25, 2002, 06:51 PM
 
</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
Reply With Quote
Jul 26, 2002, 12:34 AM
 
</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
Reply With Quote
Jul 26, 2002, 02:38 AM
 
</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 &lt;AppKit/AppKit.h&gt;, 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.
Rick Roe
icons.cx | weblog
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jul 26, 2002, 04:18 AM
 
</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 &lt;AppKit/AppKit.h&gt;, 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'."
     
   
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 12:35 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