OT: Apple Script Paths -- Image Processing

Jim Ault JimAultWins at yahoo.com
Tue Feb 6 21:42:11 EST 2007


On 2/6/07 3:55 PM, "Sivakatirswami" <katir at hindu.org> wrote:

Open the script editor and try using the following lines by changing the
comment markers.

I think you will find that there is a difference between these 3
-----------------------------------------------
as alias
as string
as POSIX path
----------------------------------------------
--the first two look the same but are not.  The Finder will not convert the
string to 'tokens' thus a file reference.  'as alias' means that what we see
as a nice string is really a 'uglytoken:uglytoken:etc' that the Finder
likes.

(watch word wrap)  paste the following into Script Editor and play

set fnALIAS to choose file "Now baby, I am ready"
set fnSTR to fnALIAS as string

--choose produces =>
--alias "Tiger130:Library:Application Support:.XDS_Store"

--tell application "Finder" to open fnALIAS --OK !!!!!!!!

--alias as sting => "Tiger130:Library:Application Support:.XDS_Store"
--tell application "Finder" to open fnSTR --err

--set tImagePath to POSIX file fnALIAS  --err
--set tImagePath to POSIX file of fnSTR --err
--set tImagePath to POSIX file path of fnSTR --err
set tImagePath to POSIX path of fnSTR  --OK, but result is not what you want
--===>"/Users/jault/Documents/listFriends.txt" --oops.. Unix

tImagePath & return & fnSTR & return & fnALIAS  --display in result

--tell application "Finder" to open tImagePath --err
--tell application "Finder" to open (tImagePath as alias) --err

Hope this helps you solve the mystery

Jim Ault
Las Vegas





More information about the use-livecode mailing list