hi there,
im trying to load an applescript from within my Cocoa-Applescript application.
It basically works, i just can’t pass the errors dictionary:
From Apple developer:
[[NSAppleScript alloc] initWithContentsOfURL:url error:&errors];
My code:
set errors to current application's NSDictionary's dictionary()
set scriptPath to makeNS_string(((current application's NSBundle's mainBundle())'s pathForResource:"HelpersFinder" ofType:"scpt")) -- Helper returns NSstring
set scriptUrl to current application's NSURL's fileURLWithPath_(scriptPath)
set appleScript to ((current application's NSAppleScript's alloc())'s initWithContentsOfURL:scriptUrl |error|:errors)
It throws an error:
[format]*** -[NSAppleScript initWithContentsOfURL:error:]: value passed to argument of type
^@ must be either missing value' or
reference’; assuming `missing value’.[/format]
I can get it to work by setting error to missing value, but i want possible errors to be added to the errors dictionary. What would be the right syntax?