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

Richard Gaskin ambassador at fourthworld.com
Tue Nov 11 12:54:44 EST 2003


Sarah wrote:

> what you were really after was a way
> to set up the relevant file associations in OS 10.3 ...

This is from a drag-and-drop file type utility that will be uploaded to
RevNet when I get time to finish its UI.

The following script relies on a field named "AppleScript" that contains:

   tell application "Finder"
     set tFilePath to "[FILE]"  as alias
     set the creator type of tFilePath to "[CREATOR]"
     set the file type of tFilePath to "[TYPE]"
   end tell


This script takes the path in a field and uses values from a "creator" field
and a "type" field to set the type and creator code.  I haven't run this on
10.3, but it works well in v10.2, with the caveat that file name extensions
apparently take precedence over type and creator code for app associations.
I would be interested in knowing if the functional AppleScript fails under
10.3:

on mouseUp
   put fld "AppleScript" into tScript
   replace "[CREATOR]" with fld "creator" in tScript
   replace "[TYPE]"    with fld "type" in tScript
   replace "[FILE]"    with UnixFile2Mac(fld "file") in tScript
   replace "[FILE]"    with tFile in tScript
   do tScript as AppleScript
   if the result <> quote&fld "TYPE"&quote then
      answer "AppleScript error" with "Drag"
   end if
end mouseUp

function UnixFile2Mac pFileName
   if char 1 of pFileName = "/" then delete char 1 of pFileName
   replace ":" with "<4WSlashPlaceHolder>" in pFileName
   replace "/" with ":" in pFileName
   replace "<4WSlashPlaceHolder>" with "/" in pFileName
   --
   if IsOSX() then
      set the itemDel to ":"
      if item 1 of pFileName <> "Volumes" then
         put line 1 of the drives &":" before pFileName
      end if
   end if
   --
   return pFileName
end UnixFile2Mac

function IsOSX
   if the platform is not "MacOS" then return false
   get the systemversion
   set the itemdel to "."
   if item 1 of it >= 10 then return true
   return false
end IsOSX


-- 
 Richard Gaskin 
 Fourth World Media Corporation
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc



More information about the use-livecode mailing list