• 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: ASObjC Beginners Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ASObjC Beginners Problem


  • Subject: Re: ASObjC Beginners Problem
  • From: Shane Stanley <email@hidden>
  • Date: Wed, 10 Apr 2013 20:51:08 +0800

On 10/04/2013, at 4:15 PM, Marion Dickten <email@hidden> wrote:

OK, so I have two questions:
1. What do I do wrong?

You have tried to coerce an NSURL to text. You need to get the path from the NSURL, using the path method, and then coerce the resulting NSString to text. And because path is a reserved term in AppleScript, you need to wrap it in pipes. So something like:

  Set thePosixPath to item 1 of theURLs's |path|()


2. What IS class ocid? I know many programming languages and environments, and in every single one so far the important thing to know was what things really were. 

An ocid item is simply an AS wrapper around an Objective-C pointer; the kptr bit is the address of the NSURL. So you can consider it to be an NSURL.

The documentation about the return value of NSOpenPanel gives me

NSURL*  theDoc = [[panel URLs] objectAtIndex:0];

So  it seems I have a pointer to an object of Class NSURL in my variable thePosixPath. 

Right.

Is there any documentation how to get from those pesky pointers to the stuff pointed to?

You can coerce, but only from a few classes: NSString to text, NSArray to list, NSDictionary to record, and NSNumber to integer/real/boolean.


-- 
Shane Stanley  <email@hidden>
 _______________________________________________
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

References: 
 >ASObjC Beginners Problem (From: Marion Dickten <email@hidden>)

  • Prev by Date: ASObjC: current application
  • Next by Date: Re: ASObjC: current application
  • Previous by thread: ASObjC Beginners Problem
  • Next by thread: ASObjC: current application
  • Index(es):
    • Date
    • Thread