AppleScript Samples

Content of the archive


Very simple AppleScript scripts to start using the BlueSense app rapidly and next develop your own scripts.


More complete examples of AppleScript I personally use:

  • Disable/Enable automatic session login
  • Start/Stop the Screen Saver with password protection
  • Play/Pause Spotify or Deezer for Mac.

Configure the scripts

Administrator password

To use this scripts you have to create a new password item, containing your administrator password, in the Mac OS X Keychain with a custom title and edit the scripts to add this title.

  1. Open Keychain app and create a new password item +N
  2. Enter a Keychain Item Name (this is the name you will enter in the scripts)
  3. Enter your short username for your "Account Name" (the name of your home folder)
  4. And your administrator password for the password

Authorize access

When you execute the script for the first time it will prompt to allow access for "security" to the keychain item, click on allow always

# Create a new password in the Keychain app with your administrator
# password and set the name here.
property KeychainPasswordName : "BlueSensePassword"

Select which parts of the script to run

You can select the parts of the script you want to run by configuring them like this

# Exemple to run the script who enable the Screen Saver password (yes/no)
property RunEnableScreenSaverPassword : yes

Spotify, Deezer, Skype

These applications have to be installed on your system to use them in the script. By default, script parts for each of these apps are commented. If you want to use one of these apps, remember to un-comment the script for each app.

script SpotifyPlayPause
	# To uncomment this script for Spotify remove (* and *)
		-- script here ...
	on error errString number errorNumber
		log (errString)
	end try
end script


AppleScripts Examples for BlueSense App

We hope that the information on these script pages is valuable to you. The sample scripts provided here are not supported under any Inspira Studio standard support program or service. All scripts are provided AS IS without warranty of any kind. Inspira Studio further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Inspira Studio, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Inspira Studio, and its authors, has been advised of the possibility of such damages.

This archive contains samples of AppleScript files that can be used with BlueSense.
Configure these scripts and move them to the BlueSense application scripts folder:
~/Library/Application Scripts/com.inspira.BlueSense

Download Applescripts Samples (32ko)