OS 10.3 no launch Rev docs -- apple script ???

Sarah sarahr at genesearch.com.au
Tue Nov 11 00:29:31 EST 2003


> Is it possible to write an apple script that will fix this and launch 
> the document with the correct application ?
>
> Has anyone done this ?

Hi Brian,

Here is an AppleScript that allows you to launch a document with a 
specified application using Panther.
It requires Rev 2.1 at least to use the revMacToUnix function for 
converting file paths, but if you don't have that, search the mailing 
list for POSIX and you'll find a function that does the same things.

As I see it, the problem will be knowing the exact file paths for both 
your application and the document file. I am not familiar with 
installers, but can your installer maker return this data or record it 
in a preference file that you could delete later?

Anyway, here is my script (watch out of line breaks):

on openDocWithApp
   -- get the path to the doc and format for AppleScript
   answer file "Select the doc:"
   put it into tDoc
   if tDoc is empty then exit to top
   put revMacFromUnixPath(tDoc) into tDoc

   -- get the path to the app and format for AppleScript
   answer file "Select the app:"
   put it into tApp
   if tApp is empty then exit to top
   put revMacFromUnixPath(tApp) into tApp

   -- construct the AppleScript, then "do" it and check for error
   put "tell application " & quote & "Finder" & quote & cr into tScript
   put "open alias " & quote & tDoc & quote & " using alias " & quote \
       & tApp & quote & cr after tScript
   put "end tell" after tScript
   do tScript as AppleScript
   if the result is not empty then answer the result
end openDocWithApp

On re-reading your email, I guess what you were really after was a way 
to set up the relevant file associations in OS 10.3 so I'm not sure 
this is any help. Sorry :-(

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/



More information about the use-livecode mailing list