Non Scripting user of one line Applescripts

Posted on
Wed Oct 09, 2019 4:36 am
Busta999 offline
User avatar
Posts: 714
Joined: Mar 30, 2016
Location: Wales UK

Non Scripting user of one line Applescripts

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.

Posted on
Wed Oct 09, 2019 5:02 am
Korey offline
User avatar
Posts: 811
Joined: Jun 04, 2008
Location: Henderson, NV

Re: Non Scripting user of one line Applescripts

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

--
Korey

Posted on
Wed Oct 09, 2019 5:03 am
Busta999 offline
User avatar
Posts: 714
Joined: Mar 30, 2016
Location: Wales UK

Re: Non Scripting user of one line Applescripts

Thanks :D

Will check those out.

Posted on
Wed Oct 09, 2019 11:06 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Non Scripting user of one line Applescripts

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.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Oct 09, 2019 2:03 pm
Busta999 offline
User avatar
Posts: 714
Joined: Mar 30, 2016
Location: Wales UK

Re: Non Scripting user of one line Applescripts

Perfect !!

Many thanks

Posted on
Thu Oct 10, 2019 5:52 am
Busta999 offline
User avatar
Posts: 714
Joined: Mar 30, 2016
Location: Wales UK

Re: Non Scripting user of one line Applescripts

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 1414 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.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests