We thought a competition would be in order...

Hi All,

By way of a quick introduction, I’m Eric from Atama (https://www.atama.io). We are one of the few companies making Mac accessories and we have recently launched a product called Sesame2. Sesame2 is a Bluetooth Low Energy keyfob that locks your Mac when you walk away and unlocks it when you come back. The concept is dead simple, but a lot went into making this product something that would useful rather than annoying…

We’re currently working on next software update, which will add support for Apple Script. Essentially, you can run any script when your Mac gets locked or unlocked. There is no real limit to the number of scripts you can run and therefore the amount of things you can do. We’ve got a few scripts ready such as:

When locking:
Set iMessage to Away
Mute Volume
Pause iTunes

When unlocking:
iMessage to Available
Restore Volume
Play iTunes

Those scripts are a great start, but we’re looking to have a few more ready for launch. So, we’ve decided to run a competition on MacScripter and we’re giving away free hardware to the lucky winners : )

Each script is fired individually when locking or unlocking so the format of them is really straight forward. For example:

Unmute script:

set volume without output muted

Play iTunes

tell application "iTunes"
	if it is running then
		play
	end if
end tell

Here’s the deal: We’re giving away a free Sesame2 to the top 3 scripts that are submitted in this thread. Maybe you’d like to open your browser to a specific page, launch an app… Well, there are a lot of things you can do we haven’t thought about.

Thanks,

Eric

PS: Thanks to Ray for okaying the competition!

Hi Eric,

Here’s some scripts I use when I’m going to sleep that you can have for free or if someone else might want to compete. :slight_smile: They might need updating.

This one clears Safari’s history:

-- clear Safari caches and history
tell application "Safari" to activate
delay 1
tell application "System Events"
	keystroke "e" using {option down, command down}
	tell process "Safari"
		tell menu bar 1
			tell menu "History"
				tell menu item "Clear History."
					click
				end tell
			end tell
		end tell
		keystroke return
		quit
	end tell
end tell

User would need to turn on accessibility features. Here’s one that might be obsolete, because there’s never anything there in the latest os:

set f to alias "Macintosh HD:Users:kelhome:Library:Caches:com.apple.Safari:Webpage Previews:"
say "Emptying Safari Webpage Previews."
tell application "Finder"
	set moved_items to move every item of f to trash
	delay 1
	if moved_items is {} then
		say "There are [[emph +]]no[[emph -]][[slnc 100]] items."
	else
		empty
	end if
end tell

This third one just quits every app. It works with my apps, but there are some apps that might foul things up. Many people don’t use those apps.

tell application "System Events" to launch
set my_name to my name
tell application "System Events"
	set visible of every process to true
	delay 0.5
	set app_ids to (bundle identifier of every process whose visible is true and name is not "Finder" and name is not my_name)
end tell
repeat with app_id in app_ids
	tell application id app_id to quit
end repeat

Things that would foul this up is if a process has a dialog open.

I remember using the remote mouse as a key fob when using the projector for my Powerpoint presentations. Just some ideas that people can use. I had more ideas back then, but anyone can use it.

Edited: and here’s a good one so people can’t see you desktop items:

tell application "Finder" to quit

Edited: forgot the opposite:

tell app "Finder" to activate

gl,
kel

Start screen saver when you walk away:

tell application "System Events" to start current screen saver

Two more very simple and useful scripts to safe battery for MacBooks.

Turn display off::

do shell script "pmset displaysleepnow"

Put the the entire machine into sleep mode:

do shell script "pmset sleepnow"

Hi all,

Martin from atama here.

Some great ideas so far! keep them coming

It seems like skype doesnt respond to the old applescript commands anymore. Does anyone know if there’s a new interface or is it dead as a dodo?