MACSCRPT Archives

October 2007

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Delacour <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 24 Oct 2007 00:44:33 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (45 lines)
At 10:33 -0700 23/10/07, Stockly, Ed wrote:

>I'm not sure why
>
>Path to "Desk" as unicode text
>
>works, but it seems to. I wouldn't recommend "path to" inside a Finder tell,
>especially when it's not needed.
>


try
   tell app "Finder" to path to desktop as Unicode text
on error e
   return e
end try
--=> "Finder got an error: Can't make desktop into type constant."

so...

tell app "Finder" to class of desktop folder
--=> constant

tell application "Finder" to class of desktop
--=> desktop-object ( when what is needed is a constant)

so give it an old-fashioned constant...

tell app "Finder" to path to «constant     desk» as Unicode text -- ! 5 spaces!
--=> you get the path

But as this compiles to

tell application "Finder" to path to desktop as Unicode text

you can only run it once without an error.  Ergo ...

run script "tell app \"Finder\" to  path to «constant     desk» as 
Unicode text"
--=> "Mac Mini:Users:j:Desktop:"

and you've fooled 'em!

JD

ATOM RSS1 RSS2