Jason Coco wrote:

I did a test with this... it seems that the code to resolve the alias in AppleScript doesn't like
non-latin encoded pathnames.


I think you're right - from dim and distant memory I seem to recall that AppleScript's '<value> as alias' coercion often doesn't work with non-ASCII paths, and you have to use an alias specifier, i.e. 'alias <value>' instead.

(The other common cause of errors is trying to create aliases for non- existent paths, of course, but I'll assume the OP already checked for that.)

Anyway, unless the OP is needing to run user-supplied scripts, I'd suggest ignoring NSAppleScript and just use a Cocoa-Apple event bridge instead.

For example, here's the objc-appscript version after using ASTranslate to get an approximate ObjC translation of the original AppleScript's Finder commands, then tweaking and tidying to suit:

        // To create glue:  osaglue  -o FIGlue  -p FI  Finder
        
        #import "FIGlue/FIGlue.h"

        int main (int argc, const char * argv[]) {
                NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
        
        int err = 0;
                
                NSURL *file = [NSURL fileURLWithPath: @"/path/to/file"];
        
FIApplication *finder = [FIApplication applicationWithBundleID: @"com.apple.finder"];

                FIReference *ref = [[[finder items] byIndex: file] 
informationWindow];

                NSError *error;
                id result = [[ref open] sendWithError: &error];
        
                if (result)
                        [[finder activate] send];
                else {
                        err = [error code];
                        NSLog(@"%@", [error localizedDescription]);
                }

                [pool drain];
                return err;
        }

HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to