Page 1 of 1

Non Scripting user of one line Applescripts

PostPosted: Wed Oct 09, 2019 4:36 am
by Busta999
So apologies upfront, I have not done scripting for about 30 years and have never touched Python and only used one line Applescripts in Indigo to get specific small tasks done.

Frankly I had forgotten that there were any Applescripts in play until I migrated to 7.4 and the following Applescripts no longer work.

Code: Select all
action group "Test - Play - Chill Playlist", action #1: execute embedded AppleScript "tell application "iTunes"..."
   action group "iTunes Play Radio 2", action #1: execute embedded AppleScript "tell application "iTunes"..."
   action group "Play BBC Radio 2 Whole House", action #3: execute embedded AppleScript "tell application "iTunes"..."
   action group "Play Glass Sound", action #1: execute embedded AppleScript "do shell script "afplay '/Library/Application Support/Perceptive Automation/Indigo 7.2/Sounds/Glass.aiff'"..."
   action group "Send an iMessage", action #1: execute embedded AppleScript "tell application "Messages"..."


Realistically the Play Glass Sound is the most important, I can live with the diminished functionality elsewhere.

If anyone can assist me in transferring these to Python - or any other way of achieving them I would much appreciate it.

Frankly I found Python daunting when I ran into a road block a year or so ago, when I found out that if I install an internet tutorial (which uses v3 of Python) it would cause grief to Indigo as it uses a different version. I just backed away knowing I could really screw things up very easily indeed.

Re: Non Scripting user of one line Applescripts

PostPosted: Wed Oct 09, 2019 5:02 am
by Korey
Busta999 wrote:
So apologies upfront, I have not done scripting for about 30 years and have never touched Python and only used one line Applescripts in Indigo to get specific small tasks done.

Frankly I had forgotten that there were any Applescripts in play until I migrated to 7.4 and the following Applescripts no longer work.

Code: Select all
action group "Test - Play - Chill Playlist", action #1: execute embedded AppleScript "tell application "iTunes"..."
   action group "iTunes Play Radio 2", action #1: execute embedded AppleScript "tell application "iTunes"..."
   action group "Play BBC Radio 2 Whole House", action #3: execute embedded AppleScript "tell application "iTunes"..."
   action group "Play Glass Sound", action #1: execute embedded AppleScript "do shell script "afplay '/Library/Application Support/Perceptive Automation/Indigo 7.2/Sounds/Glass.aiff'"..."
   action group "Send an iMessage", action #1: execute embedded AppleScript "tell application "Messages"..."


Realistically the Play Glass Sound is the most important, I can live with the diminished functionality elsewhere.

If anyone can assist me in transferring these to Python - or any other way of achieving them I would much appreciate it.

Frankly I found Python daunting when I ran into a road block a year or so ago, when I found out that if I install an internet tutorial (which uses v3 of Python) it would cause grief to Indigo as it uses a different version. I just backed away knowing I could really screw things up very easily indeed.



There are plugins for iTunes control and for sending iMessages.

I'm sure someone will chime in on how to easily play a sound for you as well. :D

Re: Non Scripting user of one line Applescripts

PostPosted: Wed Oct 09, 2019 5:03 am
by Busta999
Thanks :D

Will check those out.

Re: Non Scripting user of one line Applescripts

PostPosted: Wed Oct 09, 2019 11:06 am
by jay (support)
For the sound, use the Run Shell Script action with this as the command:

Code: Select all
/usr/bin/afplay '/full/path/to/Glass.aiff'


I believe that should work. Note that there is no Sounds folder by default in the Indigo installation, so at some point you created it and added the Glass.aiff file to it. In the future, I'd recommend putting it somewhere outside the Indigo directory structure (like in your home folder's Documents folder) which will not change as you upgrade both Indigo and macOS.

Re: Non Scripting user of one line Applescripts

PostPosted: Wed Oct 09, 2019 2:03 pm
by Busta999
Perfect !!

Many thanks

Re: Non Scripting user of one line Applescripts

PostPosted: Thu Oct 10, 2019 5:52 am
by Busta999
Works a treat :-)

Probably everyone already knows this, (new to me) but you can play MacOs built in sounds in Indigo.

So for Indigo non scripters....

Run Shell Script Action
Code: Select all
/usr/bin/afplay '/System/Library/Sounds/Glass.aiff'


There are a few to choose from that I use to draw attention to Alerts/Alarms etc

Indigo - Sounds.jpeg
Indigo - Sounds.jpeg (15.23 KiB) Viewed 1450 times


I set each of them up as Action Groups and call them from anywhere else in Indigo.

I know there are many more elegant ways to do this, but as a non scripter this gets the job done.