RE: easy way to check if item is file or folder
RE: easy way to check if item is file or folder
- Subject: RE: easy way to check if item is file or folder
- From: "Bourque, Jason" <email@hidden>
- Date: Wed, 20 Dec 2000 08:25:24 -0500
This is what I use to avoid those conflicts in the finder with get info, it
work really well when you slice and dice path i.e.
"Macintosh:Desktop Folder:" & "test folder"
when the script resolves the alias and the alias is a folder a ":" is
attached to the concationation so you get
alias "Macintosh:Desktop Folder:test folder:"
The alias is then turned into a string to test for the last character.
character -1 of "Macintosh:Desktop Folder:test folder:"
You try it.
set thisPath to choose folder
if (((thisPath) as alias) as string) ends with ":" then
display dialog "I am a folder"
end if
Hope this helps. Good Luck.
Jason Bourque
MFS Investment Management
>
----------
>
From: Erkki Pennanen
>
Sent: Tuesday, December 19, 2000 10:45 PM
>
To: email@hidden
>
Subject: easy way to check if item is file or folder
>
>
I like to get an easy solution to check if the item is file or folder.
>
>
I have tried Scripting Standard addition4s Info for command, but the
>
folder property does not give expected result (true of false). Other
>
properties of Info for command seems to give correct results.
>
>
Made as follows:
>
>
set x to info for file "Macintosh HD:Desktop Folder:File_A"
>
locked of x
>
display dialog "Locked is:" & locked of x as text -- OK!
>
folder of
>
display dialog "Folder is:" & folder of x as text x -- does not work!
>
>
What4s wrong?
>
--
>
>
Terveisin / regards:
>
>
Erkki Pennanen
>
Toimitusjohtaja / Managing Director
>
PrePress Studio Oy - PrePress Center Oy
>
Tel: +358 (0)9 34364011
>
Fax: +358 (0)9 3445455
>
Mobile: +358 (0)50 3737472
>
Turunlinnantie 8 FIN-00930 Helsinki
>
Finland
>
>
PrePress Studio Oy
>
Training and consulting for graphics arts and
>
visual digital communications
>
www.prepress-studio.fi
>
>
PrePress Center Oy
>
Dealer of computer, software and peripheral solutions
>
for graphic arts and visual digital communications
>
www.prepress-center.fi