I am new to Applescript and MACs although my first computer was an Apple II Plus and I programed in Apple Basic and Assembly.
I am using it to create a "Silent" alarm button.
We have a system in place that via a URL call will send a message to a select group of computers, in this case the ones used by our security officers.
I wrote a similar one for PCs using the AutoIT scripting language. When some one clicks on this program, as far as anyone watching the screen is concerned, nothing happens. It is 100% silent. But unseen by anyone looking at the PC screen, IE was launched minimized and hidden, a custom URL string, with an embedded message, is opened and then IE is closed. The security officers computers get a message from the message system, Informacast, and security responds accordingly. At no time is anyone watching the PC screen aware that anything has happened. It is all "Silent". Just like a silent alarm in a bank.
My MAC version, written in Applescript is working well except that the call to Safari can be seen on the screen when it takes place. It is only there for a few seconds as the URL is loaded, and then the Safari window is closed, but that few seconds is a few seconds to much and anyone watching the screen will know something happened when the alarm was pressed. I need to prevent anything from showing when Safari is launched. I need to make it "Silent".
The part of the script that opens Safari and loads the URL is shown below...
tell application "Safari"
launch
open location AlertURLString (This is the variable that has the URL and embedded message in it)
delay 1
close window 1
end tell
I have tried placing the following line in "Tell" routine in various places, before "launch" after "launch" before "open location" and after etc., but I still see a blip of the Safari window as it loads the URL string.
set miniaturized of window 1 to true
I also played around with variations of the following line but got an Applescript error every time.
tell application "System Events" to set process "Safari" to false
One more thing, it is possible that Safari or some other program could be open, maybe not full screen etc when this script is run and it is important that it not be closed or changed in any way that would clue some one in to the fact that something was happening on the system after the "Alert Button" is pressed. The "set miniaturized" line depending on how it was used would minimize the window which of course we don't want.
Again what I need is to be able to launch the URL 10000% silently.
Thanks in advance to all who are able to try and help,
Ralph