Script many could use if it could be found...


Very new to AppleScript and still trying to get my hands on all that can and can’t not be done with this great utility. The biggest problem I’m running into as of this point is finding out what can and can not be done since I really can’t find a good recourse for events offered by AppleScript enabled applications.

Anyway, the script I’m looking for has to deal with my new PowerBook. I would like to have a script that when the computer starts will:

  • Detect if the system is connected to the local wireless home network
  • if detected:
    == enabled mail status to be online
    == enabled local printer status to ‘Start Jobs’
  • else if not detected:
    == set mail to work offline
    == set local printer to ‘Stop Jobs’

For now that’s about it. I know many would like to have a script like this and most likely one already exists. If anyone could give me an example of the above script request or a link to where I could find any scripts that may offer this, please let me know.

Thanks, OZtwo

Model: PowerBook G4 12"
Browser: Internet Explorer 6.0
Operating System: Mac OS X (10.4)

This is a template:

if (do shell script "ping -c 5 -o") contains "100% packet loss" then
	--> modify printer status using UI Scripting?
	tell application "Microsoft Entourage" to set working offline to true
	--> modify printer status using UI Scripting?
	tell application "Microsoft Entourage" to set working offline to false
end if

I won’t write the UI Scripting part, as it is very boring (you can ask for it specifically in a different post), and used Entourage (as you didn’t specify your email client, I don’t know if Mail offers this feature, and I don’t have more clients to test :rolleyes: )

Yeah, that’s about what I got pictured in my mind. But being so new wanted to see if there was something else I could use other then ping.

But the main point of my post was how could one control the printer status by example and OS X Mail itself. And as I pointed out, the biggest problem I’m having with the scripting as of this point is what IS offered and What isn’t offered (well, ok, what isn’t offered is kind of easy to find). :o

Thanks for you reply

“What isn’t offered” should be covered by UI Scripting. You can search this forum and you’ll find lots of examples (ask for help if needed). You can also take a look here for a little intro:

Good luck!

Thanks for the post and link.

Before I went on to see what could be done with UI Scripting, I first just wanted to make sure there wasn’t any other way to do it with built in objects which may already support this.

Again the two objects I’m look for are:

Mail: Enabled/Disable online status
Print Utility: Enabled/Disable printer Q status.