Re: strange difference in compilation of two Foundation classes in ASObjC
Re: strange difference in compilation of two Foundation classes in ASObjC
- Subject: Re: strange difference in compilation of two Foundation classes in ASObjC
- From: Shane Stanley <email@hidden>
- Date: Mon, 20 Mar 2017 10:19:24 +1100
On 20 Mar 2017, at 4:16 am, Mitchell L Model <email@hidden> wrote:
In a brief ASObjC script I used:the following successfullymy NSFileManager's defaultManager
However, the following: my NSURL's fileURLWithPath:arg
gets compiled into: my (nsurl's fileURLWithPath:arg)
which of course doesn't work. (The parentheses are misplaced and NSURL has been lowercased.)
Nigel's given you the answer, but let me also suggest you stop using "my" that way. It only works in some contexts, it only works by chance -- it's not meant to -- and it's not guaranteed to continue working. The correct form is "current application's NSWhatever". If you find that too imposing, declare properties:
property NSWhatever : a reference to current application's NSWhatever
Script Debugger's code-completion can do that for you automatically (as well as piping |NSURL| or any other Cocoa term if required).
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden