OT: Show and Select in Finder

Sarah Reichelt sarahr at genesearch.com.au
Thu Mar 3 21:48:05 EST 2005


>> One can transform these to paths to the production server on the lan
>>
>> /Volumes/WWW/LIve_Sites/www.himalayanacademy.com/info/ 
>> advanced_search.html
>>
>> and boot them into BBEdit using the launch command... But there are  
>> times when one wants a
>>
>> "Show in Finder" command that will switch apps to the finder, and  
>> open the window-folder containing the file and select it... I believe  
>> this would be an Apple script thing... before I go digging, does  
>> anyone already have such a recipe?
>
> Yes :-)
>
> on mouseUp
>   put fld 1 into pfad
>  ## This is the filename!
>  ## pfad = german for path
>
>   replace "/" with ":" in pfad
>   put "tell application " & quote & "Finder" & quote & cr &   
> "activate" & cr & "select " & quote & (pfad) & quote & cr &  "end  
> tell" into tScript
>   do tScript as AppleScript
> end mouseUp
>
There are differences in the way AppleScript sees file names & the way  
Revolution sees them, especially if they are on a remote server.  
Changing "/" to ":" will fix some, but not all. I reckon you are better  
to use revMacFromUnixPath to get from one to the other. here is the  
function I use - just pass it the Rev-style file path and it will show  
it in the Finder.

on showFileMac pFile
   put "tell application " & quote & "Finder" & quote & cr into tScript
   put "activate" & cr after tScript
   put revMacFromUnixPath(pFile) into pFile
   put "select file " & quote & pFile & quote & cr after tScript
   put "end tell" after tScript
   do tScript as AppleScript
end showFileMac

Cheers,
Sarah



More information about the use-livecode mailing list