I am closing active document using apple script as below
tell application "Microsoft Word"
activate
try
if not (exists active document) then error number -128
close active document saving yes
on error
end try
end tell
want to do similar action using shell script. I want to gracefully close it and don't want to use kill command . And I don't want to use osascript to call an apple script . I want a graceful way using native shell commands
Hi you can use osascript in the shell code
Compile this code and make filename.sh
or you can use
To use this from cmd type $./file_name Preview application name
Here I used the reference of https://ss64.com/osx/osascript.html