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

Re: Strange path


  • Subject: Re: Strange path
  • From: Paul Berkowitz <email@hidden>
  • Date: Wed, 21 Jul 2004 08:46:12 -0700

On 7/21/04 7:59 AM, "John Azevedo" <email@hidden> wrote:

> Why am I getting the following result?
>
> set x to path to preferences
> set y to x & "foo" as text
>
> Result: "OS X:Users:zoff:Library:Preferences:/foo"
>
Because you're trying to concatenate an alias (file) with a string. That
should create a list {alias "OS X:Users:zoff:Library:Preferences:", "foo"}
which you're then coercing 'as text'. The concatenation evidently is trying
to force the second item "foo" into the same data type (alias) as the first
item. That would be a putative disk "foo:" which doesn't exist. It's one of
those weird OS X things that it apparently ends up with something like 'file
"/foo". Never mind.

If you check the 'path to' scripting addition, you'll see that the result is
'alias' - it's not a string path. What you want is

set x to path to preferences as Unicode text -- or as string
set y to x & "foo"

Result: "OS X:Users:zoff:Library:Preferences:foo"

>
> My current workaround is This:
>
> set x to POSIX path of (path to preferences)
> set y to x & "foo" as text
>
> Result: "/Users/zoff/Library/Preferences/foo"

Here at least you're concatenating Unicode text with string, which works, as
Unicode text, then coercing (for some unknown reason best known to yourself)
to text.

--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Strange path (From: John Azevedo <email@hidden>)

  • Prev by Date: Strange path
  • Next by Date: Re: Problem getting position of desktop items
  • Previous by thread: Strange path
  • Next by thread: Re: Strange path
  • Index(es):
    • Date
    • Thread