Hallo,
I created an AppleScript for my Synology NAS and saved it as NAS.app.
This starts the server and mounts the network drives.
If the script is run again when the server is already online, it can shut down the Mac and server.
That works very well.
But the next time I start the Mac, this app is immediately active again and may have to be closed manually.
I'm now looking for a way to prevent this.
How can I kill the app after issuing the shutdown command?
Here is the part with the Mac shutdown code.
set ProcNm_ to name of every application process whose visible is true
end tell
repeat with i_ from 1 to count items of ProcNm_
set TarProc_ to item i_ of ProcNm_
--display dialog TarProc_
try
if TarProc_ is not "Finder" then
tell application TarProc_ to quit "without saving"
end if
end try
end repeat
try
do shell script "sudo /sbin/shutdown -h +1"
end try
quit
I hope somebody can help me.
b. r.
Binh