Radium scripting

I’d like to select a radio station using the sdef or GUI scripting.

If I use something like the following, it will try to add the station again.

tell application "Radium" to tell player to tune in to "mp3stream3.myradio.com:8000"

And for scripting the menu bar item, I don’t see an attribute that would distinguish it from the others, e.g., AXDescription is .

I use Radium 2.8.4.

Any ideas?

Tested with Radium 3.1.3 trial

tell application "Radium" to activate
tell application "System Events" to tell process "Radium"
	set frontmost to true
	repeat
		delay 0.05
		if exists (every window whose title is "Radium") then exit repeat
	end repeat
	
	tell window "Radium"
		click at first static text
		delay 0.1
		set classesAvailable to class of UI elements
		log result --> {button, menu button, text field, button, scroll area, static text}
		if classesAvailable contains text field then
			set {xPos, yPos} to position of first text field
			set {itsWidth, itsHeight} to size of first text field
			--	click at {xPos + itsWidth div 2, yPos + itsHeight div 2}
			do shell script "/Users/admin/bin/cliclick c:" & xPos + itsWidth div 2 & "," & yPos + itsHeight div 2
			delay 0.1
			set value of first text field to "mp3stream3.myradio.com:8000"
			delay 0.5
			keystroke space
		end if
	end tell
end tell

I can’t go far because the given radio is not found and I don’t know how to get the “link” to an available one like “Jazz à Vienne”

Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) samedi 12 décembre 2015 17:52:07

Thanks for taking the time, Yvan. It seems that v3 uses a fancy window, while v2 is a bare-bones agent application. The given link is fake, but if you want to listen to jazz in Vienna, this might help (always great music, news in German, English and French at noon). Anyway, if you feel inclined, here’s a link to 2.8.4.

Hello

As a jazz listener since 1960, I’m able for years to listen Jazz in Vienna.
What I don’t know is the link which must be given to Radium to search it.
At this time I select “Jazz” then I navigate to “Jazz à Vienne”. In fact I don’t navigate because here it’s the first entry in the displayed list.

I installed Radium 2.8.4 for see but without a true link I can’t help you more.
When I ask it to search “Jazz à Vienne”, this ass it find nothing and just let me listen a kind of soup which isn’t my cup of tea.

Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) dimanche 13 décembre 2015 09:15:14

I used Accessibility Inspector → Window → Accessibility Verifier to realise that most agent applications, that I use at least, have 2 menu bars, 1 hidden with the usual application menu items, 1 visible for the sole menu bar item. From there, getting the contents down the chain was easy.

-- click menu bar item of agent application
tell application "System Events" to tell process "My Application" to tell menu bar 2
	set {{x, y}, {w, h}} to {position, size}
	do shell script "/usr/bin/cliclick -r c:" & (x + w / 2) & "," & (y + h / 2)
end tell
if not running of application "Radium" then launch application "Radium"
delay 1
tell application "System Events" to tell process "Radium"
	tell menu bar 2 -- the menu bar item
		set {{x, y}, {w, h}} to {position, size}
		do shell script "/usr/bin/cliclick -r c:" & (x + w / 2) & "," & (y + h / 2)
	end tell
	delay 0.1
	tell window 1 to tell scroll area 1 to tell group 1 -- group nr for each station
		tell button "My Radio Station" to click
	end tell
end tell

Only caveat I found is that reordering the stations changes group number, so either I keep that in mind or find a preferably elegant way to try to click the button with the radio station in every group. I tried tell every group but that didn’t work.

As for Jazz à Vienne, use http://jzr-vienne.ice.infomaniak.ch/jzr-vienne.mp3, see here. It worked for me.

This is a version that takes full screen into account.

if not running of application "Radium" then launch application "Radium"
delay 1
tell application "System Events" to tell process "Radium"
	tell menu bar 2 -- the menu bar item
		set {{x, y}, {w, h}} to {position, size}
		if y < 0 then set y to 0 -- full screen
		do shell script "/usr/bin/cliclick -r m:" & x & "," & y & " w:800 c:" & (x + w / 2) & "," & (y + h / 2)
	end tell
	delay 0.2
	tell window 1 to tell scroll area 1 to tell group 2 -- group nr for each station
		tell button "My Radio Station" to click
	end tell
end tell
-- drag station from Radium to Finder, from there drag inetloc to applescript to get url text
tell application "Radium" to tell player to tune in to "radium://tune-in/radioURL&"