• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [newbie] applescript in cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >[newbie] applescript in cocoa (From: Francesca P <email@hidden>)

  • Prev by Date: Easy Fetched Property question.
  • Next by Date: Re: scriptSuite error in app that was fine in Panther
  • Previous by thread: [newbie] applescript in cocoa
  • Next by thread: Easy Fetched Property question.
  • Index(es):
    • Date
    • Thread