More Control with version 1/2

It’s here. The next version of Remote Control. It has the version number 0.5. Why the jump from 0.1 to 0.5? Because I think it is a major step towards 1.0.

This version is inspired by the feedback and comments of a lot of people. Special thanks go to John Evans, Axel Rauschmayer and Andrew James. The code was developed in the presence of the great new Red Hot Chili Peppers album.

So what’s in?

The major goal of version 0.5 was to implement most of the core features of 1.0.

What’s new: (the big ones)

  • Totally new UI elements for application selection, menus and a new Front Row like file chooser. There are still some glitches and performance issues that will be fixed in the next versions.
  • An enhanced Script Editor with some kind of build-in help
  • Auto take control of front most app. Activate an app with mouse, keyboard, … and just use your remote to control it (as long as there is a script for this app)
  • Support of Left/Right-Button-Hold events
  • and a lot more refinements, bug fixing, … (ever tried to press and hold the play button?)

What’s not in this version, but will be in the next version:

  • Import/Export. The menus are already there but not active at the moment
  • Support for a default application. With this version you can already define an application as the default application. A default application will get events if no other application is active at the moment.
  • More scripts for more apps…
  • Developer support for those that do not have a Mac with a remote control
  • A new name. Yes. Inspired by a comment of Axel Rauschmayer this baby will get a new name. If you have any ideas for a name just leave a comment.
  • Bugfixing…

Your help is needed!

  1. Feedback & spread the word: Please download this software, send it to friends, teammates and anyone that could be interested in such a piece of software. The more feedback the better will be the first final version of this app.

  2. Scripts: There is also a lot of room for more scripts to do even more with your remote control. The example scripts that are shipping with the program shall give a good introduction for script developers. If you are not able to write scripts for yourself but you have an idea for a script please send an email or leave a comment here.

Upgraders from version 0.1: Please remove the directory “RemoteControl” from your “Library/Application Support” folder before you start the new version. The new version will automatically install the newest versions of the application scripts. Note: Make a copy of any scripts which you have made before you remove this file. The next version will provide an easier way.

Download of RemoteControl 0.5 Beta - Universal Binary. Keep in mind that this software is still in beta!

Feedback Email: remotecontrol@martinkahr.com

26 Responses to “More Control with version 1/2”

  1. semaja2 Says:

    great to see improvments, even though i dont own a mac with a apple remote ill be watching this closely

  2. Mads Says:

    How can i deactivate RemoteControl 0.5 Beta?

  3. Mads Says:

    i found it out…

  4. martin Says:

    I’m glad you found it out Mads.

    Just for the records. To deactivate RemoteControl you can hold the menu button of your remote control for a second or disable it through the menu (statusbar or application menu, dependent of the “hide the dock icon” setting)

    @semaja2: another set of improvements in a week :)

  5. deng kun Says:

    here is a script to control acrobat.

    thanks for this wonderful app.

    global arrowLeftCode
    global arrowRightCode
    global plusCode
    global minusCode
    global escCode
    set arrowLeftCode to 123
    set arrowRightCode to 124
    set plusCode to 69
    set minusCode to 78
    set escCode to 53

    on rcLeft()
    tell application “System Events”
    set procPreview to first process where name is “Preview”
    if not procPreview is null then tell procPreview to key code arrowLeftCode
    end tell
    end rcLeft

    on rcRight()
    tell application “System Events”
    set procPreview to first process where name is “Preview”
    if not procPreview is null then tell procPreview to key code arrowRightCode
    end tell
    end rcRight

    on rcPlus()
    tell application “System Events”
    set procPreview to first process where name is “Preview”
    if not procPreview is null then
    tell procPreview to key code plusCode using {command down}
    (* for the next line UI Scripting must be enabled in order to work )
    (
    tell procPreview to click menu item “Zoom” of menu 1 of menu bar item “Window” of menu bar 1 *)
    end
    end tell

    end rcPlus

    on rcMinus()
    tell application “System Events”
    set procPreview to first process where name is “Preview”
    if not procPreview is null then
    tell procPreview to key code minusCode using {command down}

        end
    end tell
    

    end rcMinus

    on rcPlay()
    tell application “System Events”
    set procPreview to first process where name is “Preview”
    if not procPreview is null then
    tell procPreview to click menu item “Slideshow” of menu “View” of menu bar item “View” of menu bar 1
    end
    end tell
    end rcPlay

    on rcMenu()
    tell application “System Events”
    set procPreview to first process where name is “Preview”
    if not procPreview is null then tell procPreview to key code escCode
    end tell
    end rcMenu

  6. deng kun Says:

    oops, wrong one. the above one is for preview under full screen mode.

    here it is:

    global pageDownCode
    global pageUpCode
    global plusCode
    global minusCode
    global escCode
    set pageDownCode to 121
    set pageUpCode to 116
    set plusCode to 69
    set minusCode to 78
    set escCode to 53

    on rcLeft()
    tell application “System Events”
    set procA to first process where name is “Acrobat”
    if not procA is null then tell procA to key code pageUpCode
    end tell
    end rcLeft

    on rcRight()
    tell application “System Events”
    set procA to first process where name is “Acrobat”
    if not procA is null then tell procA to key code pageDownCode
    end tell
    end rcRight

    on rcPlus()
    tell application “System Events”
    set procA to first process where name is “Acrobat”
    if not procA is null then
    tell procA to key code plusCode using {command down}
    end
    end tell
    end rcPlus

    on rcMinus()
    tell application “System Events”
    set procA to first process where name is “Acrobat”
    if not procA is null then
    tell procA to key code minusCode using {command down}
    end
    end tell
    end rcMinus

    on rcPlay()
    tell application “System Events”
    set procA to first process where name is “Acrobat”
    if not procA is null then
    (* for the next line UI Scripting must be enabled in order to work *)
    tell procA to click menu item “Full Screen” of menu “View” of menu bar item “View” of menu bar 1
    end
    end tell
    end rcPlay

    on rcMenu()
    tell application “System Events”
    set procA to first process where name is “Acrobat”
    if not procA is null then
    (* perform action to quit full screen *)
    tell procA to key code escCode
    end
    end tell
    end rcMenu

  7. martin Says:

    Thanks a lot for the feedback and the script!

  8. semaja2 Says:

    Martin, i have found a way to bypass the password prompt in MultiAlarm and when i release it i will add the newer scripts

  9. Ian Says:

    Okay, I’m stumped. Where is the script editor? Or do I just edit RemoteControl.xml by hand?

    Thanks for the Acrobat script… that was going to be my first script attempt! I do presentations using PDF files and was very disappointed when the Apple Remote didn’t control Acrobat out of the box (or indeed provide any scripting capability).

  10. martin Says:

    To get access to the script editor open the settings window through the menu. Choose the “Applications” icon in the settings window.
    The big text area is the editor :) To see the full script of an application choose “Full script (Expert)” in the popup menu at the top of the text area.
    If you would have expected it to be more simple or more obvious please drop a line.

  11. mmm Says:
    • the sample script for VLC has a file chooser menu but the default type doesn’t emcompass all of VLC’s playable types (avi, mpeg, mkv, ogm, etc.) and nor does the chooser follow aliases; e.g. my media stuff is on a networked drive and I just put an alias to that network folder in my movies folder

    • will events be added for up and down holding?

    • “remote manager show messsage” doesn’t seem to support unicode characters

    • I tried scripting something for my image viewer by having right press activate the application then sending a key code (e.g. page down), couldn’t get this to work as it seemed like RemoteControl was hanging processing the event

  12. martin Says:

    Thanks for the input.
    The VLC script uses “remote manager choose file of type { “public.movie” }” which restricts to file of types public.movie. The type parameter is a list of content types. Therefore you can define the types as { “public.movie”, “public.audio”}. I’ll extend that in the next version for the VLC script.
    Support for aliases, up/down holding in the file chooser shall also be done in one of the next versions.

    I’ll check that unicode character problem.

    The Preview script shall give you an example on how to control an app with key strokes. If RemoteControl crashes please send me the crash report. If it seems to hang please open the Activity Monitor, double click the RemoteControl process and press the “sample” button and send me the output. This will help a lot to isolate the problem.
    Of course you can post or send your script and I’ll try to help you with that.

  13. Ian Says:

    More obvious is better, I think I’m just missing something obvious.

    I double-click on the RemoteControl app, and I get a FrontRow-ish message that it’s enabled. Pressing ‘menu’ on my remote gives me a list of apps, but no other menu. Where is the ’settings’ menu?

    Thanks for helping an idiot…

  14. Ian Says:

    Duh, I found it, there’s a menu bar widget. Sorry for the noise.

  15. martin Says:

    I am glad you found it!
    I’m thinking about some kind of “Intro-Screen” that shall appear on first launch. It will also include the information about the menu bar widget.

    Thanks for your comments and for remembering me that things that are obvious for the programmer must not be obvious to the end user.

  16. mmm Says:

    Using Xee as my image viewer, http://macupdate.com/info.php/id/19978 and using the same script as Preview but with the process name as key codes replaced.

    I’ve provided a ’sample’ log here:
    http://rapidshare.de/files/21651605/remote.control.txt.html

    At this point, I can still bring up the application menu in RC but none of the custom events ‘work’ anymore. Had a few times where RC wouldn’t even respond but it doesn’t crash.

  17. martin Says:

    Thanks a lot for the sample file. Something crazy is going there. Seems like the “auto take control” feature is activating different applications all the time. You can turn off that feature in the general preferences until the next version.

    Unfortunatly I was unable to reproduce bug until now. I played a little with the Xee application and everything was fine with the following script. Perhaps you’ll give that a try, too. This one makes sure that the Xee application is the front most application when a button is pressed, too.

    – Xee Script
    global pageDownCode
    global pageUpCode
    global plusCode
    global minusCode
    set pageDownCode to 121
    set pageUpCode to 116
    set plusCode to 69
    set minusCode to 78

    on rcPlus()
    tell application “Xee”
    activate
    end tell
    tell application “System Events”
    set procPreview to first process where name is “Xee”
    if not procPreview is null then tell procPreview to key code pageUpCode
    end tell
    end rcPlus

    on rcMinus()
    tell application “Xee”
    activate
    end tell
    tell application “System Events”
    set procPreview to first process where name is “Xee”
    if not procPreview is null then tell procPreview to key code pageDownCode
    end tell
    end rcMinus

    on rcPlay()
    tell application “Xee”
    activate
    end tell
    tell application “System Events”
    set procPreview to first process where name is “Xee”
    if not procPreview is null then
    tell procPreview to key code plusCode using {command down}
    (* for the next line UI Scripting must be enabled in order to work *)
    tell procPreview to click menu item “Zoom” of menu 1 of menu bar item “Window” of menu bar 1
    end
    end tell
    end rcPlay

    on rcMenu()
    tell application “Xee”
    activate
    end tell
    tell application “System Events”
    set procPreview to first process where name is “Xee”
    if not procPreview is null then tell procPreview to key code minusCode using {command down}
    end tell
    end rcMenu

    on rcActivate()

    — code that will be executed if the application is activated

    tell application “Xee”
    activate
    end tell
    end rcActivate

  18. mmm Says:

    No deal, same problem with Xee.

    The sampling is much more sane though with that option turned off:
    300 Thread0f07
    300 start
    300 _start
    300 NSApplicationMain
    300 -[NSApplication run]
    300 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
    300 _DPSNextEvent
    300 BlockUntilNextEventMatchingListInMode
    300 ReceiveNextEventCommon
    300 RunCurrentEventLoopInMode
    300 CFRunLoopRunInMode
    300 CFRunLoopRunSpecific
    300 mach
    msgtrap
    300 mach
    msgtrap
    300 Thread
    1003
    300 pthreadbody
    300 forkThreadForFunction
    300 +[NSURLConnection(NSURLConnectionInternal) resourceLoadLoop:]
    300 CFRunLoopRunInMode
    300 CFRunLoopRunSpecific
    300 mach
    msgtrap
    300 mach
    msgtrap
    300 Thread
    1103
    300 pthreadbody
    300 forkThreadForFunction
    300 +[NSURLCache diskCacheSyncLoop:]
    300 CFRunLoopRunInMode
    300 CFRunLoopRunSpecific
    300 mach
    msgtrap
    300 mach
    msg_trap

  19. mmm Says:

    I take it back, it does work except for the arrow keys. I’m sending 125 and 126 to pan up and down the current image in Xee and for some reason, that doesn’t seem to work. But the other keys all work now with the auto take control option disabled.

    On another note, I can’t get RC’s menu by simpling holding down menu. I have to hold it down, let go and then click menu to bring it up. Can you give us the option to have menu always bring up the RC menu in the next version? ie. disable custom mapping of menu button

  20. Ian Says:

    I added deng kun’s script (changing the names to “Adobe Reader” since I’m running version 7.0.7), but the check button for “enable for remote control” never becomes clickable. Maybe I put the script in wrong..? I just created a new entry and then cut-and-pasted into the “complete script” view. Is there some additional magic?

    Confession: this Macbook is new and I am a longtime Unix and Linux user. I’m more used to a command line and vi than GUI stuff, so when I have to guess I usually guess wrong ;-)

  21. martin Says:

    @mmm: Thanks for the feedback. Great that it works now. The sample looks pretty normal. There must be some problem in conjunction with the script and the auto take control feature. For some reason remote control switches between two apps (perhaps there is some “Preview” code still in the script?). There will be fixes in this area in the next release.

    Regarding the up/down arrow problem with Xee. That’s a problem of Xee. For whatever reason it does recognize the up/down arrow system events. I’ve tested that with Script Editor. The same up/down arrow code works for other apps (Safari, …).

    Regarding the Menu Hold. You can already do what you want on a little bit different way.
    Just add the following line to the menu button script.

    set active application of remote manager to “”

    This will deactivate the current app. When you check the preference “show application menu after a remote controllable application exists” than the app chooser will show up automatically. With this preference enable, a single Menu Hold (just for a second) will bring up the app chooser.

  22. martin Says:

    Hi Ian. Congratulations to your new MacBook!

    Well. It looks like you were doing everything right.
    The magic is, that Remote Control tries to be smart :)

    When you add or change a script, Remote Control tries to determine which application is scripted. It searches for “tell application ‘xyz’” in the script.
    In this version the first one that is being found is used to determine the app name. With the app name Remote Control asks the OS if the application is installed. If the OS says no, Remote Control disables the “enable for remote control” switch.

    So the problem is that Remote Control gets the wrong app name or the OS does not find the Acrobat Reader program.

    I installed the acrobat reader and found a bug in Remote Control :) Adobe named the app “Adobe Reader 7.0.7″ and it’s the version number that is the problem here. By making a copy of the app and renaming the copy to “Adobe Reader” it worked. (Note: I had to start the “Adobe Reader” app in order to be recognized by RemoteControl).

    So that shall be a interim-solution till the next version.

    Thanks for the problem report!

  23. mmm Says:

    martin: Thanks for your help. I’ve given up on the problem with Xee for now.

    The menu trick kind of works; .I have to ‘double-click’ the menu button but that’s still quicker than holding the menu button. One more thing to report, if I click on the left and right buttons quickly, I can ‘escape’ beyond the application icons in the RC menu.

  24. Ian Says:

    I tried copying and renaming the Adobe Reader app, but it still didn’t get recognized. I noticed in the script that all the instances of “tell application” were directed at System Events, not Adobe Reader. I added “tell application “Adobe Reader” (* hello world *) end tell” to the script, and it allowed me to enable it, but gave me an error message.

    Adobe sux, but it is the only PDF reader with decent full-screen support. I will keep poking, but additional hints always appreciated!

  25. martin Says:

    Stay tuned. In less than 48 hours there will be a new version. The first of Sofa Control.
    It includes a fix for your problem.

  26. Download Revelation Ringtone Says:

    Download Revelation Ringtone…

    Hear the ringtone of the popular song: Download Revelation …