Invisible Safari

I have a mail rule that runs an applescript. The applescript accesses a mail message which provides a URL. Safari then accesses the URL to get some info which then provides a further URL to post a reply. The script works just fine but I don’t want to see it working, just want it to do its thing in the background. In Mail I set the colours of the “flags” to see the outcome of the posting process (green all is well, red something went wrong etc)

I would like Safari to “run in the background”. i.e. I would like the whole process to be "invisible.

At present when a mail message arrives various safari windows popup, things happen and then they close again.

Is this possible and if so do any of you knowledgeable guys have a solution.

All help is very much appreciated.

Model: iMac i7 Lion
Browser: Firefox 13.0.1
Operating System: Mac OS X (10.7)

You can try something like this:

tell application "Safari"
	set visible of window 1 to false
end tell

I’ll try to explain: Mac OS X is like any other desktop like KDE and GNOME. This means Safari is a process like any other process. In all these processes a set of processes is responsible for something named Mac OS X. From now on interpret Mac OS X as a bundle of processes; which makes the following explanation better to understand. When Safari starts-up it will be binded to some processes in Mac OS X and tell Mac OS X that it is running (An application is born). Depending on the settings in the info.plist plist file, Mac OS X will show the application (or not), load the main nib file and send the appropriate messages through the workspace(s). So every process is already running in the background unless you turn Mac OS X off (quite useful for servers).

So to answer your question: Can’t be done; You can only make the presentation of an application inside Mac OS X invisible but doesn’t turn anything in the background or not. Wouldn’t it be simpler that you use curl to send and receive some data between your script and the server? So keep your rule in mail and script the same except for the tell application “Safari” block. Unless the web page is a JavaScript driven web page like sencha (formerly known as ExtJS) then curl would be a problem of course.

Thank you for the reply.

Yep, your right, cURL is the way to go to read stuff from a web page. Exactly what I’m looking for.
Use a get command which I’ve tested in the terminal.

However.
I ain’t no applescript or HTML guru…no type of guru at all in fact, so…

Can cURL enter text into a web form feild like
“”
Or

and click “submit” ?

All help is very much appreciated.

You should explore curl -d. Browser add ons such as Firebug can give you the values that are posted when you click submit.