Re: Scripting Bridge link error
On Sep 9, 2009, at 8:12 PM, Jason Foreman wrote: You don't actually instantiate ScriptingBridge objects directly like that. The interface header is generated so you can get type checking when you call methods, but the actual class is acquired dynamically at runtime. See the documentation for - classForScriptingClass: in SBApplication. You'll need to do something more like: AdobePhotoshopCS3JPEGSaveOptions *options = [[psApp classForScriptingClass:@AdobePhotoshopCS3JPEGSaveOptions] new]; DOH! Totally missed the line Do not use a class name in the sdp- generated header file as the receiver of the alloc method. I'm sure that wasn't there the first time I read the docs! ;) Thanks, Jason. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Scripting Bridge link error
On Sep 9, 2009, at 8:12 PM, Jason Foreman wrote: You don't actually instantiate ScriptingBridge objects directly like that. The interface header is generated so you can get type checking when you call methods, but the actual class is acquired dynamically at runtime. See the documentation for - classForScriptingClass: in SBApplication. You'll need to do something more like: AdobePhotoshopCS3JPEGSaveOptions *options = [[psApp classForScriptingClass:@AdobePhotoshopCS3JPEGSaveOptions] new]; OK, now that I've successfully created this options object...what the heck do I do with it?! I create the object in the first place in order to pass it as the past argument to a document's - saveIn:as:copying:appending:withOptions: method. It doesn't really belong to a container object (AFAICT), so when the doc says Immediately after creating the object, insert it in the appropriate element array. The object is not “viable” in the application until it has been added to its container. Consequently, you cannot set or access its properties until it’s been added., I'm at a loss figuring out which container it is supposed to be added to before I can even do options.quality=12; in order to pass it to that method. I'd love to be able to query the document to get this (so that I can do this only if the quality is not already 12), but I've found no way via AppleScript to find this out. Currently, I'm using do shell script to run the command line tool 'exiftool' to query the image file for the PhotoshopQuality EXIF value, but I'd like to avoid this if possible. Any tips would be greatly appreciated! Thanks! randy___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Scripting Bridge link error
I am trying to use Scripting Bridge to do some minor control of Adobe Photoshop CS3 from my Cocoa app. I have followed the instructions in the Scripting Bridge Programming Guide for Cocoa, specifically: 1. Generate header files for all scriptable applications that your code is sending messages to: I used sdef /Users/Shared/Adobe\ Photoshop\ CS3/Adobe\ Photoshop\ CS3.app | sdp -fh --basename AdobePhotoshopCS3 to generate this header. 2. Add these files to your project. (done) 3. In your header or implementation files, add #import statements for the generated header files. (done) 4. Add the Scripting Bridge framework to your project. (done) Here is the modest amount of code I'm using right now: AdobePhotoshopCS3Application *psApp = [SBApplication applicationWithBundleIdentifier:@com.adobe.Photoshop]; if ([psApp isRunning]) { SBElementArray *docs = [psApp documents]; NSUInteger index ; AdobePhotoshopCS3Document *doc; AdobePhotoshopCS3JPEGSaveOptions *options = [AdobePhotoshopCS3JPEGSaveOptions new]; options.quality = 12; for (index = 0; index [docs count]; index++) { doc = [[docs objectAtIndex:index] get]; [doc saveIn:doc.filePath as:AdobePhotoshopCS3SvFmJPEG copying:NO appending:AdobePhotoshopCS3E300NoExtension withOptions:options]; } [options release]; } It compiles fine, but I get this link error: Undefined symbols: .objc_class_name_AdobePhotoshopCS3JPEGSaveOptions, referenced from: literal- poin...@__objc@__cls_r...@adobephotoshopcs3jpegsaveoptions in AMBatchEditMonitor.o ld: symbol(s) not found collect2: ld returned 1 exit status It's in the header file that got generated @interface AdobePhotoshopCS3JPEGSaveOptions : AdobePhotoshopCS3SaveOptions @property BOOL embedColorProfile; // embed color profile in document @property AdobePhotoshopCS3E270 formatOptions; // ( default: standard ) @property AdobePhotoshopCS3E880 matte; @property NSInteger quality; // quality of produced image ( 0 - 12; default: 3 ) @property NSInteger scans; // number of scans. Only valid for progressive type JPEG files ( 3 - 5 ) @end but where's the object code for it? The other classes used (AdobePhotoshopCS3Application and AdobePhotoshopCS3Document) are apparently linked OK, so what gives with the JPEGSaveOptions? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Scripting Bridge link error
On Sep 9, 2009, at 8:52 PM, Randall Meadows wrote: AdobePhotoshopCS3JPEGSaveOptions *options = [AdobePhotoshopCS3JPEGSaveOptions new]; [...] It compiles fine, but I get this link error: Undefined symbols: .objc_class_name_AdobePhotoshopCS3JPEGSaveOptions, referenced from: literal- poin...@__objc@__cls_r...@adobephotoshopcs3jpegsaveoptions in AMBatchEditMonitor.o ld: symbol(s) not found collect2: ld returned 1 exit status You don't actually instantiate ScriptingBridge objects directly like that. The interface header is generated so you can get type checking when you call methods, but the actual class is acquired dynamically at runtime. See the documentation for -classForScriptingClass: in SBApplication. You'll need to do something more like: AdobePhotoshopCS3JPEGSaveOptions *options = [[psApp classForScriptingClass:@AdobePhotoshopCS3JPEGSaveOptions] new]; Jason smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com