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 > Carbon and Contextual Menu Plugin help

Carbon and Contextual Menu Plugin help
Thread Tools
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Jan 13, 2003, 10:46 AM
 
I've been trying to write an incredibly simple CMP for quite some time, but Carbon is driving me absolutely crazy. All I need to do is:

1. Create a menu item when there's only one file selected and that file is a package containg "Contents/Resources/edit_info"

2. When selected, it reads in a dictionar from a given spot, delets a key, (which is read in from "Contents/Resources/app_identifier"), and then writes out the dictionary again.

This is all trivial in Cocoa, but Carbon is giving me fits. Here's my first problem:

Code:
OSStatus CMPluginExamineContext( void *thisInstance, const AEDesc *inContext, AEDescList *outCommandPairs ) { DEBUG_STR( "\pEmptyCM->CMPluginExamineContext" ); AbstractCMPluginType *theThis = (AbstractCMPluginType *)thisInstance; if(inContext == NULL) return errAENotAEDesc; if(inContext->descriptorType == typeNull) return errAENotAEDesc; Ptr theData; Size theLength; OSStatus err; /* find out the length of the data stored in the descriptor record */ theLength = AEGetDescDataSize(inContext); /* allocate a buffer to hold a copy of the data */ theData = (Ptr)malloc(theLength); if (theData != NULL) { /* copy the data to the buffer */ err = AEGetDescData(inContext, theData, theLength); if ( err == noErr) { /* perform some operation with the extracted data */ } } //HELP! }
Right up to the HELP comment I think I'm okay. So after I get this data from the AEDesc (which I think I'm doing correctly), how can I get the paths that are in this data? I might be able to fumble around with the Carbon File Manager to see if has the path I'm looking for, but I'm not sure how to extract data from the data I've already extracted.

I'll leave working with dictionaries for another day - I need to get this worked out first.

Thanks (God I love Cocoa),
Matt Fahrenbacher
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Jan 14, 2003, 08:48 AM
 
So... anyone able to at least point me in the right direction? A Tech Note or something? A piece of a example code that illustrates this? Anything?

Thanks,
Matt Fahrenbacher
     
   
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 02:02 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