Plex Script - Salling Clicker

Hey Guys!



This is my first post here. Sorry if i’m posting in the wrong part of the forum.



Today I was trying to find a script for Plex and found this post in Boxee forum (Link). I changed the script a little bit, hope you enjoy:



//**



LAST VERSION: 06/05/2010:



[Tutorial] - Tutorial___Salling_Clicker.rtf (1.07 KB)

[Normal Version - By FboO] - Plex__Updated_.rtf (72.9 KB)

[Extended Version - By Akrug] - Plex_Media_Center__Extended_.rtf (67.7 KB)



**//



Thanks to MasterZap (from Boxee forum).



FboO [Brazil]

Thanks for sharing this!



Rildo Moraes [From Brazil too] :wink:

De nada!



I forgot to put the real Play/Pause key (Space Bar).

New versions:



[Directional] - Plex_Media_Center__New_.rtf (72.9 KB)



[Numerical] - Plex_Media_Center__Numerical___New_.rtf (72.8 KB)



FboO [Brazil]




Thanks, It works Great!


Thank you for the great job!

Does anyone know how to implement a text field function to this script, so that one could use the phone's T9 system for searches on YouTube etc.? Here's how it would work: When a text dialog opens in Plex, the user presses star and a text field appears on the phone. The user types in text using the phone's interface, and presses Done. Then all the apple script have to do is to transfer the user input to System Events keystrokes or something similar.

I've been trying to implement this myself, but even though I'm used to apple script, scripting for Salling Clicker really confuses me. I've managed to write a script that opens a text field in the phone when you launch the script, but not one that doesn't open the text field until you press star.

Many thanks!


Actually, I found it out myself:

First:

else if the_key is "*" then
tell terminal of the_keypad to push (make new text field dialog with properties {name:"Text", title:"Type", prompt:"Type text"})

Later:

on process dialog ok the_widget
set txt to value of the_widget
repeat with char in characters of txt
simulate keyboard charcode (ASCII number (char))
delay 0.01
end repeat
end process dialog ok

I have Nokia 6120 Classic (s60v3).

Script works but not the volume and other buttons. I can move up, bottom, reght, left, I can play, pause.



Which version of leopard do you have? Which build of Plex?



I have Mac Os 10.5.2 and I tried Plex 0.5.22 and Plex 0.7.7.



I tried all the scripts on this page.

Thanks for the help.



I have Mac OS 10.5.6 and Plex 0.7.13. Maybe is your keyboard layout, try using this program [[Full Key Codes](http://www.versiontracker.com/dyn/moreinfo/macosx/21215)] and check the key code for this keys:

[-] (Should be 27 Dec)
[=] (Should be 24 Dec)
[S] (Should be 1 Dec)
[C] (Should be 8 Dec)
[Esc] (Should be 53 Dec)
[Space Bar] (Should be 49 Dec)

If something is different, tell me.

FboO [Brazil]


Nice Job Akrug, would be nice from you to put the whole script.

Thanks

FboO [Brazil]



Here's the whole script with the text input function. I have also modified the keys pressed to make use of both the numerical keypad and the directional buttons, as well as added a function for recent text entries.


property keymap_info : {{key_code:"s", key_title:"Enter", key_description:""}, {key_code:"<", key_title:"Nav. left", key_description:""}, {key_code:">", key_title:"Nav. right", key_description:""}, {key_code:"^", key_title:"Nav. up", key_description:""}, {key_code:"v", key_title:"Nav. down", key_description:""}, {key_code:"f", key_title:"Menu", key_description:""}, {key_code:"5", key_title:"Play/Pause", key_description:""}, {key_code:"1", key_title:"Minimize video", key_description:""}, {key_code:"2", key_title:"Vol. +", key_description:""}, {key_code:"8", key_title:"Vol. -", key_description:""}, {key_code:"4", key_title:"Skip backward", key_description:""}, {key_code:"6", key_title:"Skip forward", key_description:""}, {key_code:"3", key_title:"Sys. vol. +", key_description:""}, {key_code:"9", key_title:"Sys. vol. +", key_description:""}, {key_code:"7", key_title:"Contextual menu", key_description:""}, {key_code:"*", key_title:"Text entry", key_description:""}, {key_code:"0", key_title:"Recent text entries", key_description:""}}<br />
property savedTextInput : {}<br />
<br />
using terms from application "SEC Helper"<br />
	on process invoke a_terminal<br />
		<br />
		tell application "Plex" to activate<br />
		<br />
		tell a_terminal<br />
			set my_keypad to make new keypad screen<br />
			set title of my_keypad to "Plex Media Center"<br />
			tell my_keypad<br />
				make new text row with properties {horizontal alignment:center, font size:medium}<br />
			end tell<br />
			push my_keypad<br />
		end tell<br />
	end process invoke<br />
	<br />
	on update keypad the_keypad<br />
		set textual content of the first text row of the_keypad to "Use the directional controls and the Menu button to navigate. Use the keypad for extended functionality." & return & "Press # for Help"<br />
	end update keypad<br />
	<br />
	on process key down the_key sent from the_keypad<br />
		tell application "Plex" to activate<br />
		if the_key is "#" then<br />
			show keypad help keymap keymap_info title "Plex Remote Help"<br />
		else if the_key is "*" then<br />
			tell terminal of the_keypad to push (make new text field dialog with properties {name:"textEntry", title:"Text entry", prompt:"Text entry"})<br />
		else if the_key is "0" then<br />
			tell terminal of the_keypad to push (make new list screen with properties ¬<br />
				{item labels:savedTextInput, title:"Recent text entries", selected item:1, name:"recentTextEntry"})<br />
		else if the_key is "s" then<br />
			simulate keyboard virtual down keycode 36 -- return<br />
		else if the_key is ">" then<br />
			simulate keyboard virtual down keycode 124 -- right<br />
		else if the_key is "<" then<br />
			simulate keyboard virtual down keycode 123 -- left<br />
		else if the_key is "^" then<br />
			simulate keyboard virtual down keycode 126 -- up<br />
		else if the_key is "v" then<br />
			simulate keyboard virtual down keycode 125 -- down<br />
		else if the_key is "f" then<br />
			simulate keyboard virtual down keycode 53 -- esc<br />
		else if the_key is "1" then<br />
			simulate keyboard virtual down keycode 48 -- tab<br />
		else if the_key is "2" then<br />
			simulate keyboard virtual down keycode 69 -- +<br />
		else if the_key is "4" then<br />
			simulate keyboard virtual down keycode 43 -- ,<br />
		else if the_key is "5" then<br />
			simulate keyboard virtual down keycode 35 -- p<br />
		else if the_key is "6" then<br />
			simulate keyboard virtual down keycode 47 -- .<br />
		else if the_key is "7" then<br />
			simulate keyboard virtual down keycode 8 -- c<br />
		else if the_key is "8" then<br />
			simulate keyboard virtual down keycode 78 -- -<br />
		else if the_key is "3" then<br />
			simulate keyboard special key volume up<br />
		else if the_key is "9" then<br />
			simulate keyboard special key volume down<br />
		end if<br />
		return true<br />
	end process key down<br />
	<br />
	on process key up the_key sent from the_keypad<br />
		simulate keyboard cleared<br />
		return true<br />
	end process key up<br />
	<br />
	on process dialog ok the_widget<br />
		typewriter(value of the_widget)<br />
	end process dialog ok<br />
	<br />
	on process updated value a_widget for property a_property<br />
		typewriter(item (selected item of a_widget) of savedTextInput)<br />
		return false<br />
	end process updated value<br />
	<br />
end using terms from<br />
<br />
on typewriter(txt)<br />
	using terms from application "SEC Helper"<br />
		repeat with char in characters of txt<br />
			simulate keyboard charcode (ASCII number (char))<br />
			delay 0.01<br />
		end repeat<br />
	end using terms from<br />
	set newSavedTextInput to {}<br />
	set counter to 0<br />
	repeat with x in savedTextInput<br />
		if x as text is not txt as text then<br />
			set newSavedTextInput to (newSavedTextInput as list) & x as list<br />
			set counter to counter + 1<br />
		end if<br />
		if counter is 9 then exit repeat<br />
	end repeat<br />
	set savedTextInput to (txt as list) & newSavedTextInput as list<br />
end typewriter

Where do i put any of these scripts? A bit clueless??



Copy and paste into a new Script Editor document, save anywhere and pull it into Salling Clicker's configuration.


i will make a tutorial as soon as possible.

edited: it is in the first post, enjoy.

FboO [Brazil]

New Version!



FboO [Brazil]

is there away to communicate with Plex without the need of focusing on Plex (something similar to iTunes controller)?



It would be great that way, so that I can control plex and work on my mac at the same time.



EDIT: Just wondering if we can control Plex via HTTP protocol? Then we can ignore the focus dependence



GREAT WORK!!!! THANKS!!!! GO BRAZILLLLLLL!!!!

PARABENS!!!

Thanks for the updates…Also im waiting for the tutorial to be made…Hope this will come… :lol:





Regards





Albert



________

Pret immobilier



The tutorial is in the first post..

or here..Tutorial___Salling_Clicker.rtf (1.07 KB)

FboO

Hm, the scripts work somewhat for me.

Probably because I have an “unusual” phone, a Nokia E71, which has numeric keys only through the use of a special key combination, these scripts only work sub-optimal.



I have many media with multiple audio tracks, so I switch a lot between them.



However, I seem to be unable to configure it in a way that pressing the “m” (or any button for that matter) will bring up the in-movie menu.



Can anyone of you wizards please tell me how to achieve this?



Thank you and greetings.


  • Thomas

Hey Thomas…



The “in-movie” menu is the button “5” in the cellphone.



Maybe you’re using the old script, I am gonna remove it in any case.



Tell me if it worked…



Fábio