FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Request for XBMC-Script

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac
View previous topic :: View next topic  
Author Message
BeBoP
Newbie


Joined: 21 Feb 2008
Posts: 1

PostPosted: Thu Feb 21, 2008 8:41 pm    Post subject: Request for XBMC-Script Reply with quote

:oops:
I'm sorry that my first post here will be a request...
anyway, XBMC has come a long way for the mac and the only thing that stopping me from using it, is that I can't remotely control it from salling.

I saw that there was a script for windows out, but I havent got the skills to convert it to use it on my mac.

If anyone have the knowlegde, please help.
Back to top
View user's profile Send private message
tritip
Newbie


Joined: 25 May 2008
Posts: 1

PostPosted: Sun May 25, 2008 9:42 pm    Post subject: Reply with quote

Ok, here is my pathetic attempt at an XBMC script for Salling.
It works great for me, although the "#" Help is not working.
To implement this, I looked at everyone else's scripts, mainly
Front Row, VLC, MythTV, Keyboard+Mouse(Treo).
BIG THANK YOU to Jonas and the authors of all the other scripts.

Updated: Basic phone buttons are bound to common XBMC commands,
and also, QWERTY keyboard keys are *all* passed through as well,
at least on my Treo 650/680.

[code:1]
property kReturnKeycode : 2 * 16 + 4
property kRightKeycode : 7 * 16 + 12
property kLeftKeycode : 7 * 16 + 11
property kUpKeycode : 7 * 16 + 14
property kDownKeycode : 7 * 16 + 13
property kEscKeycode : 3 * 16 + 5
property kCommandKeycode : 3 * 16 + 7
property k_I_Keycode : 34
property k_C_Keycode : 8
property k_X_Keycode : 7
property k_Z_Keycode : 6
property kBackspcKeycode : 51

property keymap_info : {{key_code:"s", key_title:"Play/Pause/OK", key_description:""}, {key_code:"<", key_title:"Left", key_description:""}, {key_code:">", key_title:"Right", key_description:""}, {key_code:"^", key_title:"Up", key_description:""}, {key_code:"v", key_title:"Down", key_description:""}, {key_code:"f", key_title:"Context Menu", key_description:""}, {key_code:":c", key_title:"Up one level", key_description:""}, {key_code:":o", key_title:"Escape", key_description:""}, {key_code:":m", key_title:"Info", key_description:""}, {key_code:"c", key_title:"Change Aspect", key_description:""}}

using terms from application "SEC Helper"

on launch_widget(the_terminal)
tell the_terminal
set player to make new mediaplayer screen with properties {title:"XBMC", name:"mediaplayer"}
tell player
make new text row with properties {horizontal alignment:center, overflow:wrap, font size:large}
end tell
push player
end tell
end launch_widget

on is_application_launched()
return check application availability "XBMC"
end is_application_launched

on process invoke a_terminal
if my is_application_launched() then
my launch_widget(a_terminal)
else
tell a_terminal to push (make new question dialog with properties {textual content:"Launch XBMC?", name:"launcher"})
end if
end process invoke

on process dialog ok a_widget
if name of a_widget is "launcher" then
-- "ok to launch" dialog?
tell application "XBMC" to activate
my launch_widget(terminal of a_widget)
end if
end process dialog ok

--- This handler is called (as per prefpane setting) repeatedly. Use it to update the
--- keypad object's properties to show current status of your script.
--- NOTE 1: Make sure your script behaves reasonably even if this handler is never called; the user
--- may have chosen to never idle-update the display (prefpane setting).
--- NOTE 2: This script handler *must* execute quite quickly.
--- NOTE 3: Setting the keypad text often will cause the battery to drain more quickly as there's more
--- Bluetooth activity and some devices will turn on backlighting when the display is updated.
on update keypad the_keypad
set textual content of the first text row of the_keypad to "Use the directional controls and the Menu button to navigate."
end update keypad

on process screen exit the_screen
show screen message "exit"
end process screen exit

--
-- Key handling
--

on process key down the_key sent from the_keypad
if the_key is "#" then
show keypad help keymap keymap_info title "OSXBMC Help"

else if the_key is "f" then --- osd menu button and menu button
simulate keyboard virtual down keycode k_C_Keycode --- context menu

else if the_key is ":o" then --- phone button
simulate keyboard virtual down keycode kEscKeycode --- escape

else if the_key is ":c" or the_key is "0x0008" then --- calendar button or backspace
simulate keyboard virtual down keycode kBackspcKeycode --- up one level

else if the_key is ":m" then --- mail button
simulate keyboard virtual down keycode k_I_Keycode --- info

else if the_key is "c" then --- home button
simulate keyboard virtual down keycode k_Z_Keycode --- change aspect ratio

else if the_key is "s" then --- ok/center button
simulate keyboard virtual down keycode kReturnKeycode --- ok/select

else if the_key is ">" then
simulate keyboard virtual down keycode kRightKeycode
else if the_key is "<" then
simulate keyboard virtual down keycode kLeftKeycode
else if the_key is "^" then
simulate keyboard virtual down keycode kUpKeycode
else if the_key is "v" then
simulate keyboard virtual down keycode kDownKeycode

else if the_key starts with "'" then
simulate keyboard charcode (ASCII number character 2 of the_key)
else
show screen message "'" & the_key & "' was pressed"
end if
return true
end process key down

on process key up the_key sent from the_keypad
if the_key is "f" then
simulate keyboard virtual up keycode k_C_Keycode
else if the_key is ":o" then
simulate keyboard virtual up keycode kEscKeycode
else if the_key is ":c" or the_key is "0x0008" then
simulate keyboard virtual up keycode kBackspcKeycode
else if the_key is ":m" then
simulate keyboard virtual up keycode k_I_Keycode
else if the_key is "c" then
simulate keyboard virtual up keycode k_Z_Keycode
else if the_key is "s" then
simulate keyboard virtual up keycode kReturnKeycode
else if the_key is ">" then
simulate keyboard virtual up keycode kRightKeycode
else if the_key is "<" then
simulate keyboard virtual up keycode kLeftKeycode
else if the_key is "^" then
simulate keyboard virtual up keycode kUpKeycode
else if the_key is "v" then
simulate keyboard virtual up keycode kDownKeycode
end if
return true
end process key up


end using terms from

[/code:1]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group