Forums > MaxMSP

Applescript to shell issues using osascript

June 15, 2012 | 9:01 am

I felt like I had this somewhat under control, but I have tried everything (from the forum, to trial and error, and google) and cannot get this particular one right. I would appreciate you help!

The usual " to get this " is not working in Osascript.

This is the script I need:

tell application "System Events"
set MyList to (name of every process)
end tell
if (MyList contains "Spotify") is true then
tell application "Spotify" to open location "spotify:track:THIS-NEED-TO-DYNAMIC"
end if

I’m fine if I hard code everything, but I need the part that says "THIS-NEED-TO-DYNAMIC" to change as needed. Sprintf is not being my friend (and all other ways).

This feels like the closest:

– Pasted Max Patch, click to expand. –

In Luke’s JS here: http://cycling74.com/forums/topic.php?id=25026 It’s all good (hard coded). It spits out with the line breaks (even into a message box?!), so thought I could recreate this by filling textedit using a separator, also ascii conversions to add a "return". But no luck.

Everything I try has issues. I don’t understand why its not seeing my " as "

Thanks for any help!


December 12, 2013 | 8:01 am

Hello

I’m not sure it responds to the question, but this one works with Spotify and a valid n° of track.
I’m using tap.applescript, do you use another objet to live applescript ?

<code>

– Pasted Max Patch, click to expand. –

</code>


December 12, 2013 | 12:27 pm

Hey! Thanks for responding. This was a year and a half ago so luckily I had found a solution using [shell]

Here is my version:

<code>

– Pasted Max Patch, click to expand. –

</code>

Cheers!


Viewing 3 posts - 1 through 3 (of 3 total)