Applescript to launch X11 GV or ghostview application
As I moved to Catalina, and 32 bit apps don't work anymore, I'm trying to recreate a droplet that could open a postscript file using the gv command. In the past I used the XDroplet app, which did the trick in a complicated way but this is 32 bit.
I now wrote a simple applescript:
run application "XQuartz"
on open filelist
repeat with filename in filelist
set mycmd to "/opt/local/bin/gv " & POSIX path of filename
do shell script mycmd
end repeat
end open
tell application "XQuartz" to activate
but while this does open XQuartz and the gv app, the app then gets stuck (small clock) and never opens the actual file which I dropped.
Instead I found that if I modify the script to launch the same from within a terminal, then everything works:
run application "XQuartz"
on open filelist
repeat with filename in filelist
set mycmd to "/opt/local/bin/gv " & POSIX path of filename
tell application "Terminal"
do script mycmd & "; exit"
end tell
end repeat
end open
tell application "XQuartz" to activate
Could anybody tell me why I cannot make it work without running within the Terminal?
Thanks
MacBook Pro 15", OS X 10.11