• 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: posix path argument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: posix path argument


  • Subject: Re: posix path argument
  • From: Axel Luttgens <email@hidden>
  • Date: Mon, 05 Jun 2006 11:02:25 +0200

On 4/06/06 22:21, Nir Soffer wrote:

[...]

I found (thanks Gnarlodious) much nicer solution:

    set aPath to "/foo/bar"
    tell application "TextEdit"
        open my POSIX file aPath
    end tell

Anyone has a clue why you need "my" for "posix file"?

Deivy has already pointed a possible terminlogy conflict; may be a consequence of the Cocoa framework coming with scripting support.

But such a conflict doesn't appear for a string->object coercion [1]:

    set aPath to "/foo/bar"
    get POSIX file aPath
    get aPath as POSIX file
    tell application "TextEdit"
        -- get POSIX file aPath
        get aPath as POSIX file
    end tell

Also, the error you get if you leave out "my" is not very helpful.

Hmmm... ;-)

Try this code with a path to exiting file:

    set aPath to "/foo/bar"
    tell application "TextEdit"
        open POSIX file aPath
    end tell

You get:

TextEdit got an error: Can't make POSIX file \"/foo/bar\" into type alias.

Instead of something about posix file.

But if you try with "get" instead of "open" (translated from french):

    TextEdit got an error: Can't make POSIX file \"/foo/bar\" into type reference.

No mention to alias anymore (which probably appeared because TextEdit expects an alias for its open command). The second error message may appear to be more explicit as to the underlying problem.


As a comparison, under 10.3.9, the error is:

    TextEdit got an error: NSCannotCreateScriptCommandError

with both "get" and "open".


Regards,
Axel


[1] I don't remember having ever seen that coercion explicitely documented. Someone?
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: posix path argument (From: Nir Soffer <email@hidden>)

  • Prev by Date: Re: posix path argument
  • Next by Date: Internet Connect
  • Previous by thread: Re: posix path argument
  • Next by thread: Internet Connect
  • Index(es):
    • Date
    • Thread