Re: [newbie] applescript in cocoa
Re: [newbie] applescript in cocoa
- Subject: Re: [newbie] applescript in cocoa
- From: Damien Bobillot <email@hidden>
- Date: Mon, 25 Jul 2005 16:04:30 +0200
Le 25 juil. 05 à 15:50, Francesca P a écrit :
I'm trying to run an applescript from a cocoa application.
This is my code:
path = [[NSBundle mainBundle] bundlePath];
path1=[(path)stringByDeletingLastPathComponent];
scriptCartella=[NSString stringWithFormat: @"tell application
\"Finder\" \n set cartella to \"%@\" \n set cartella2 to path of
cartella \n set cartellapb to \"cartellaZ\" \n if not (exists
folder cartellapb of cartella2) then make new folder at cartella2
with properties {name:cartellapb} \n end tell",path1];
scriptt=[[NSAppleScript alloc] initWithSource:scriptCartella];
[scriptt executeAndReturnError:nil];
[scriptt release];
I've a problem.
If I set the path manually the application works.
But using path1 it doen't work.
I think is a problem of path in applescript (slash, or : or
Posix...I don't know).
AppleScript use the ':' path separator and use the format
<disk>:<path on the disk>, even for the boot disk.
You may convert POSIX paths to applescript's paths with : «POSIX file
"/path/to/file"» instead of «"volume:path:to:file"» (in applescript
code).
--
Damien Bobillot
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden