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:
Nigel Garvey <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 23 Oct 2007 10:17:58 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
Levon Spradlin wrote on Mon, 22 Oct 2007 17:22:46 -0500:

>=20   I get an AppleScript Runtime Error when trying this simple code.

>tell application "Finder"
>=20   set theDesktop to path to desktop as Unicode text
>end tell
>
>Finder got an error: Can't make desktop into type constant.

There's a terminology clash between the 'desktop' keyword used by the
Finder and the 'desktop' keyword used by the StandardAdditions command
'path to'.

The best recourse is not to use the command in a Finder 'tell' block:

  set theDesktop to (path to desktop as Unicode text)


If it has to be in a Finder 'tell' block, you can either use Deivy's
suggestion - ie. use 'path to' with the four-character text alternative
to the keyword:

  tell application "Finder"
    set theDesktop to (path to "desk" as Unicode text)
  end tell


... or use the Finder itself:

  tell application "Finder"
    set theDesktop to desktop as Unicode text
  end tell


NG

ATOM RSS1 RSS2