reveal file/folder in Finder

Sarah sarahr at genesearch.com.au
Wed Sep 10 18:04:01 EDT 2003


This won't quite work because the Unix path doesn't include the disk 
name, and revMacFromUnixPath() just changes the slashes to colons but 
doesn't add the disk name. Here is a function that I (with help from 
this list), came up with to convert Unix/OS X file paths to Applescript 
paths:

function filePathToAppleScript pFile
   put "set tFilePath to *file*" & cr & "set tAS to POSIX file 
tFilePath" \
       & cr & "return tAS" & cr into tScript
   replace "*file*" with quote & pFile & quote in tScript
   do tScript as Applescript
   put the result into tASfile
   delete word 1 of tASfile    -- file
   delete char 1 of tASfile    -- quote
   delete char -1 of tASfile   -- quote

   return tASfile
end filePathToAppleScript

Then use the file path returned by this function as the parameter for 
Ken's AppleScript below.

Cheers,
Sarah


On Thursday, September 11, 2003, at 03:19  am, Ken Ray wrote:

> You almost stated it yourself:
>
> tell application "Finder"
>   reveal <pathToFileOrFolder>
> end tell
>
> Since AppleScript wants colon-delimited paths, you can call on a useful
> set of handlers from Rev that's in the Common Library:
>
>   put revMacFromUnixPath(<unixPath>) into myPath
>
> Hope this helps,
>
> Ken Ray
> Sons of Thunder Software
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
>>
>> Does anyone have the recipe for 'revealing' a folder in the Finder
>> (OSX) from a Rev script? This used to be a snap in Apple Events. I
>> can't find the syntax anywhere....
>>
>> thanks
>>
>> stephen barncard _______________________________________________




More information about the use-livecode mailing list