Code: Select all
Procedure simpleShell(ShellCommand$)
Protected shell
shell = RunProgram("/bin/sh","","", #PB_Program_Open|#PB_Program_Write)
If shell
WriteProgramStringN(shell,ShellCommand$)
WriteProgramData(shell,#PB_Program_Eof,0)
CloseProgram(shell)
EndIf
EndProcedure
PV.s = ~"\"Preview\""
; CLOSE FRONTMOST WINDOW
simpleShell("osascript -e 'tell app " + PV + " to close window 1'")
; QUIT
simpleShell("osascript -e 'tell app " + PV + " to quit'")