Can I use a variable for a refreshing image URL?

Posted on
Mon Jun 01, 2015 3:42 pm
Londonmark offline
Posts: 509
Joined: Feb 29, 2012

Can I use a variable for a refreshing image URL?

Can't find this anywhere (but maybe I've missed it). Can I use a variable for a refreshing image URL? I'm using the Sonos plugin and can populate a variable with the URL of the cover art. I then want to get that onto a control page. I could write a script to copy the url to a fixed file location, but that seems unnecessarily complicated...

Posted on
Mon Jun 01, 2015 7:12 pm
DaveL17 offline
User avatar
Posts: 6782
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Can I use a variable for a refreshing image URL?

As far as I know, there's no way to use a variable in that way. Fortunately, for this purpose--you don't have to.

You can put cover art onto a control page using the following convention:
Code: Select all
file:///Library/Application%20Support/Perceptive%20Automation/images/Sonos/kitchen_art.jpg
file:///Library/Application%20Support/Perceptive%20Automation/images/Sonos/office_art.jpg
file:///Library/Application%20Support/Perceptive%20Automation/images/Sonos/workshop_art.jpg

it will update to the image of the current item.

Dave

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Jun 01, 2015 7:57 pm
matt (support) offline
Site Admin
User avatar
Posts: 21426
Joined: Jan 27, 2003
Location: Texas

Re: Can I use a variable for a refreshing image URL?

Dave is correct – that doesn't exist in Indigo currently. It is, however, on our feature request list.

Image

Posted on
Tue Jun 02, 2015 12:35 am
Londonmark offline
Posts: 509
Joined: Feb 29, 2012

Re: Can I use a variable for a refreshing image URL?

Thanks for the quick response. Just what I needed.

(Edited to remove a follow-up question that wasn't needed.)

Posted on
Sat Oct 03, 2015 9:23 am
pacman offline
Posts: 67
Joined: Sep 17, 2008
Location: Pacifica, CA

Re: Can I use a variable for a refreshing image URL?

It took awhile to figure this out. Some information is missing regarding how to go from the Sonos plug-in inserting the URL (ZP_Art state) into a variable to getting the variable (ZP_Art URL) to update the "Refreshing Image URL" element on a web page. I used this simple AS:

tell application "IndigoServer"
set _Source to value of variable "SonosArt" as text --SonosArt is the variable name
end tell
tell application "Finder"
do shell script "curl _Source -o
file:///Library/Application%20Support/Perceptive%20Automation/images/Sonos/Library_art.jpg" --Library_art.jpg is the target file
end tell

I use a trigger to run the above script every time Sonos changes tracks (Device State Change)

Posted on
Sat Oct 03, 2015 2:09 pm
pacman offline
Posts: 67
Joined: Sep 17, 2008
Location: Pacifica, CA

Re: Can I use a variable for a refreshing image URL?

Another note regarding this. I use snippets I find searching the internet and this forum so please poke holes in my last post as it is all trial and error. The script works as an embedded script, something I have tried to get away from. When I copy and paste the scrip into a new script file, add the external reference to IndigoServer, it does not work. It returns a shell script error.

tell application "IndigoServer" of machine "eppc://username:passwprd@192.168.0.66"
set _Source to value of variable "SonosArt" as text --SonosArt is the variable name
end tell
tell application "Finder"
do shell script "curl _Source -o
file:///Library/Application%20Support/Perceptive%20Automation/images/Sonos/Library_art.jpg" --Library_art.jpg is the target file
end tell

error "Finder got an error: curl: option -o: requires parameter
curl: try 'curl --help' or 'curl --manual' for more information
sh: line 1: file:///Library/Application%20Support/Perceptive%20Automation/images/Sonos/Library_art.jpg: No such file or directory" number 127

I think it doesn’t see “_Source” constant. Please help if you can. Thank you.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests