• 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
NSAppleScript error that is not an error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSAppleScript error that is not an error


  • Subject: NSAppleScript error that is not an error
  • From: Mark Steinberg <email@hidden>
  • Date: Tue, 17 Jun 2003 19:22:01 -0400

I am executing an apple script using NSAppleScript. The code looks
like this:

+(void) makeAliasForPath:(NSString *)thePath andNameIt:(NSString
*)theAliasName
{
NSLog(@"Make alias for path = %@", thePath);
NSAppleScript *theScript;
NSDictionary *errorDict;

NSString *theSource2 =[NSString stringWithFormat:@"tell application
\"Finder\"\nset thePath to POSIX file \"%@\"\nset theAlias to make new
alias file at desktop to thePath\nset the name of theAlias to
\"%@\"\nend tell\n", thePath, theAliasName];

NSLog(theSource2);
theScript = [[NSAppleScript alloc] initWithSource:theSource2];

[theScript executeAndReturnError:&errorDict];
NSLog([errorDict description]);
}

It returns an error every time and yes, the path is valid. The NSLog
output looks like this:

2003-06-17 18:15:38.225 MakeAlias[5289] Make alias for path =
/Volumes/Monster/Applications/Acrobat Reader 5.0
2003-06-17 18:15:40.978 MakeAlias[5289] tell application "Finder"
set thePath to POSIX file "/Volumes/Monster/Applications/Acrobat Reader
5.0"
set theAlias to make new alias file at desktop to thePath
set the name of theAlias to "AAAAlias"
end tell
2003-06-17 18:16:07.452 MakeAlias[5289] {
NSAppleScriptErrorBriefMessage = "Can't make a alias file.";
NSAppleScriptErrorMessage = "Finder got an error: Can't make a
alias file.";
NSAppleScriptErrorNumber = -2710;
NSAppleScriptErrorRange = <00000077 00000029 >;
}

if I select the dump of the Applescript above and paste it into
ScriptEditor I get exactly the same error when I execute it. Here's
the catch. If I select any character in the script within ScriptEditor
and retype that character, the script executes properly without error.

Any help will be greatly appreciated.

Mark
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSAppleScript error that is not an error
      • From: Nathan Day <email@hidden>
  • Prev by Date: [ANN] The Cocoa 3D Tutorial project has a web page! (and a new release)
  • Next by Date: Re: monitor child process...
  • Previous by thread: Re: [ANN] The Cocoa 3D Tutorial project has a web page! (and a new release)
  • Next by thread: Re: NSAppleScript error that is not an error
  • Index(es):
    • Date
    • Thread