Salling Clicker script for DVDPedia

Talk to other Pedia users about the programs, share tricks and tips or ask questions about existing features.

Salling Clicker script for DVDPedia

Postby kseiferlin » Tue Sep 05, 2006 6:47 am

For those of you who use Salling Clicker as a bluetooth mobile phone remote control for your Mac: here is a simple Salling Clicker script to control DVDpedia from your moble.

If you don't know Salling Clicker yet: it is definetely worth to try out. http://www.salling.com/

If you are familiar with SC, you probably know what to do with the script below:
1) Open the SC preferences
2) Select the Clicker Objects tab
3) In the left list, create a new category, called (for instance) DVDpedia
4) Under this category, create a new script. Chose "Option list" as the script type. Give a descitpive name to the script, e.g. DVDpedia.
5) Open the script in the script editor
6) Delete all lines in the script and replace it by teh script below.
7) Save the script. It should compile without errors.
8) Drag the new category from the right list to the left list (the one that reflects the menu as it appears on your mobile phone
9) Press the Apply now button onthe lower right in the preferences pane
10) You are ready to use it

A few comments about the script: DVDpedia currently has no applescript interface implemented. Thus, it is not possible to call DVDpedia functions in a direct way. But one can still send keystrokes to DVDpedia, which will behave exactly as if you would have pressed these keys on your keyboard. This allows to control at least a basic functionality. The script below implements 4 cursor keys for navigation in the table view, cover view or fullscreen mode, it allows to switch the info pane on and off, to switch between table and cover view, to toggle fullscreen, and to start "play" if a play-able file is linked. However, the "play" command is activated by either "p" (in fullscreen mode) or "command-p" in normal mode - therefore, the script contains 2 play commands. In addition there are two commands that control Quicktime (which would most probably be opened when you clicked "play"): it allows to close the frontmost quicktime window, and to toggle fullscreen mode for Quicktime.
(A complete Quicktime remote control with advanced features comes with Salling Clicker, so there was no need to implement more quicktime functions). Feel free extend the script by other commands you may need.

Code: Select all
using terms from application "SEC Helper"
   
   on process invoke a_terminal
      tell a_terminal
         set the_list to make new list screen with properties {title:"DVDPedia", selected item:2}
         set item labels of the_list to {"Table view", "Cover view", "Left", "Right", "Up", "Down", "Show/hide info", "Toggle full screen", "Play", "Play (DVDpedia in fullscreen mode)", "(Quicktime) Close frontmost", "(Quicktime) Fullscreen"}
         push the_list
      end tell
   end process invoke
   
   on process updated value the_widget
      --show screen message "item " & (selected item of the_widget) & " was selected"
      set sel to (selected item of the_widget)
      tell application "DVDpedia" to activate
      
      if sel is 1 then
         tell application "SEC Helper" to simulate keyboard charcode (ASCII number "t") modifiers {"option", "command"}
         return
      end if
      if sel is 2 then
         tell application "SEC Helper" to simulate keyboard charcode (ASCII number "c") modifiers {"option", "command"}
         return
      end if
      
      if sel is 3 then
         tell application "SEC Helper" to simulate keyboard virtual keycode 123
         return
      end if
      if sel is 4 then
         tell application "SEC Helper" to simulate keyboard virtual keycode 124
         return
      end if
      if sel is 5 then
         tell application "SEC Helper" to simulate keyboard virtual keycode 126
         return
      end if
      if sel is 6 then
         tell application "SEC Helper" to simulate keyboard virtual keycode 125
         return
      end if
      if sel is 7 then
         tell application "SEC Helper" to simulate keyboard charcode (ASCII number "i") modifiers {"command"}
         return
      end if
      if sel is 8 then
         tell application "SEC Helper" to simulate keyboard charcode (ASCII number "F") modifiers {"option", "command"}
         return
      end if
      if sel is 9 then
         tell application "SEC Helper" to simulate keyboard charcode (ASCII number "p") modifiers {"option"}
         return
      end if
      if sel is 10 then
         tell application "SEC Helper" to simulate keyboard charcode (ASCII number "p")
         return
      end if
      if sel is 11 then
         tell application "QuickTime Player" to activate
         tell application "SEC Helper" to simulate keyboard charcode (ASCII number "w") modifiers {"command"}
         return
      end if
      if sel is 12 then
         tell application "QuickTime Player" to activate
         tell application "SEC Helper" to simulate keyboard charcode (ASCII number "f") modifiers {"command"}
         return
      end if
      
      return true -- dismiss the list when an item is selected
   end process updated value
   
   on process screen exit the_screen
      --show screen message "exit"
   end process screen exit
   
end using terms from
kseiferlin
Contributor
Contributor
 
Posts: 5
Joined: Sat Sep 02, 2006 6:39 am
Location: Bern

Postby Conor » Thu Sep 21, 2006 12:14 pm

Thank you for the script. Always great to see the program being extended in all kinds of cool ways. :P
User avatar
Conor
Top Dog
 
Posts: 5212
Joined: Sat Jul 03, 2004 12:58 pm


Return to PediaTalk

cron