Changes between Version 2 and Version 3 of AppleScript


Ignore:
Timestamp:
Apr 19, 2011 12:31:42 PM (10 years ago)
Author:
toby
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppleScript

    v2 v3  
    55I find that sometimes it works better to recompile the !AppleScript in the !AppleScript Editor (Applications/Utilities or in 10.4 Applications/AppleScript/AppleScript Utility)
    66
    7 == This version of the script has been tested in 10.5 and 10.6. == #leopard
     7== This version of the script has been tested in 10.6 and similar versions have been tested in 10.5 so it should run there too. == #leopard
    88{{{
    99(*   Launch EXPGUI: launches EXPGUI by double clicking on app or by dropping a data file or folder on the app
     
    1313original script by F. Farges; farges@univ-mlv.fr ;  changes by B. Toby brian.toby@anl.gov
    1414
    15 To debug this script, I suggest changing the lines with
    16         set results to do shell script ...
    17 to send output to path /tmp/expgui.txt rather than /dev/null (use of >> rather than > is a good idea too.)
     15To debug this script, create file /tmp/EXPGUIdebug.txt (from command line: touch /tmp/EXPGUIdebug.txt)
     16The output from launching EXPGUI will be appended to the end of that file.
    1817*)
    1918
     
    6463     or if not present there, in the place where Fink would install it
    6564 o it opens X11 (if needed)
    66  o then it converts the colon-delimited macintosh file location to a POSIX filename
    67  o for every non-directory file dragged into the icon, it tries to open that file in soffice
    6865--------------------------------------------------------------
    6966*)
    7067on run
     68        set Prefix to "cd ~;DISPLAY=:0.0 PATH=$PATH:/usr/local/bin:/usr/X11R6/bin "
     69        tell application "Finder"
     70                if POSIX file "/tmp/EXPGUIdebug.txt" exists then
     71                        set Output to "/tmp/EXPGUIdebug.txt"
     72                else
     73                        set Output to "/dev/null"
     74                end if
     75        end tell
    7176        set myPath to (path to me)
    7277        set ParentPath to GetParentPath(myPath)
     
    8085        end tell
    8186       
    82         set results to do shell script "cd ~;DISPLAY=:0.0 PATH=$PATH:/usr/local/bin:/usr/X11R6/bin " & WishExe & " " & posixapp & "  > /dev/null 2>&1 &"
     87        set results to do shell script Prefix & WishExe & " " & posixapp & "  >> " & Output & " 2>&1 &"
    8388end run
    8489
     
    9398 o it goes through the list of files dragged in
    9499 o then it converts the colon-delimited macintosh file location to a POSIX filename
    95  o for every non-directory file dragged into the icon, it tries to open that file in soffice
     100 o for every non-directory file dragged into the icon, it tries to open that file in the script
    96101-----------------------------------------------------------------------
    97102*)
     
    99104on open names
    100105       
     106        set Prefix to "DISPLAY=:0.0 PATH=$PATH:/usr/local/bin:/usr/X11R6/bin "
     107        tell application "Finder"
     108                if POSIX file "/tmp/EXPGUIdebug.txt" exists then
     109                        set Output to "/tmp/EXPGUIdebug.txt"
     110                else
     111                        set Output to "/dev/null"
     112                end if
     113        end tell
    101114        set myPath to (path to me)
    102115        set ParentPath to GetParentPath(myPath)
     
    116129                        (* if this is a directory; start EXPGUI in that folder *)
    117130                        set filename to the quoted form of the POSIX path of macpath
    118                         set results to do shell script "cd " & filename & ";DISPLAY=:0.0 PATH=$PATH:/usr/local/bin:/usr/X11R6/bin " & WishExe & "  " & posixapp & " > /dev/null 2>&1 &"
     131                        set results to do shell script "cd " & filename & ";" & Prefix & WishExe & "  " & posixapp & "  >> " & Output & " 2>&1 &"
    119132                else if macpath ends with ".EXP" then
    120133                        (* if this is an experiment file, open it *)
    121134                        set filename to the quoted form of the POSIX path of macpath
    122                         set results to do shell script "cd ~;DISPLAY=:0.0 PATH=$PATH:/usr/local/bin:/usr/X11R6/bin " & WishExe & " " & posixapp & " " & filename & " > /dev/null 2>&1 &"
     135                        set results to do shell script "cd ~;" & Prefix & WishExe & " " & posixapp & " " & filename & "  >> " & Output & " 2>&1 &"
    123136                else
    124137                        display dialog "This is not a valid GSAS Experiment file: " & macpath with icon caution buttons {"OK"}