Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: posix path argument



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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.