Re: make new as alias
Re: make new as alias
- Subject: Re: make new as alias
- From: "Stockly, Ed" <email@hidden>
- Date: Thu, 15 Oct 2009 09:44:34 -0700
- Thread-topic: make new as alias
Title: Re: make new as alias
If x is not and alias, then when you ask for the (class of item x) you are asking for:
Class of item folder [reference to folder]
Class of folder [reference to folder]
Or
Class of item [reference to folder]
Look at the apple event log for this script:
tell application "Finder"
set x to (make new folder at desktop with properties {name:"TEST-FOLDERj"}) --as alias
set varType to (class of x) as text
try
class of x
--set objType to (class of item x) as text
set objType to (class of item (x as text) as text)
set objType to (class of folder (x as text) as text)
on error ERRTEXT
set objType to "error"
display dialog varType & ", " & objType & return & ERRTEXT
end try
display dialog varType & ", " & objType
end tell
---------
tell application "Finder"
make new folder at desktop with properties {
name:"TEST-FOLDERj"
}
--> folder "TEST-FOLDERj" of folder "Desktop" of folder "edstockly" of folder "Users" of startup disk
get class of folder "TEST-FOLDERj" of folder "Desktop" of folder "edstockly" of folder "Users" of startup disk
--> folder
get class of folder "TEST-FOLDERj" of folder "Desktop" of folder "edstockly" of folder "Users" of startup disk
--> folder
get folder "TEST-FOLDERj" of folder "Desktop" of folder "edstockly" of folder "Users" of startup disk
--> "MacOSX:Users:edstockly:Desktop:TEST-FOLDERj:"
get class of item "MacOSX:Users:edstockly:Desktop:TEST-FOLDERj:"
--> folder
get folder "TEST-FOLDERj" of folder "Desktop" of folder "edstockly" of folder "Users" of startup disk
--> "MacOSX:Users:edstockly:Desktop:TEST-FOLDERj:"
get class of folder "MacOSX:Users:edstockly:Desktop:TEST-FOLDERj:"
--> folder
display dialog "folder, folder"
--> {
button returned:"OK"
}
end tell
And here is the log for the command that errors:
set objType to (class of item x) as text
-----
get class of item (folder "TEST-FOLDERi" of folder "Desktop" of folder "edstockly" of folder "Users" of startup disk)
display dialog "folder, error
Can't make class of item («class cfol» \"TEST-FOLDERi\" of «class cfol» \"Desktop\" of «class cfol» \"edstockly\" of «class cfol» \"Users\" of «class sdsk» of application \"Finder\") of application \"Finder\" into type string."
end tell
If x is an alias, (class of item x) is asking for the class of the item the alias points to.
HTH,
ES
On 10/15/09 7:57 AM, "Luther Fuller" wrote:
tell application "Finder"
set x to (make new folder at desktop with properties {name:"TEST-FOLDER"}) -- as alias
set varType to (class of x) as text
try
set objType to (class of item x) as text
on error
set objType to "error"
end try
display dialog varType & ", " & objType
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden