Support
All support resources for our products. Here you can find answers to frequently asked questions, discuss with other users, recover a lost license code or file a support request.
Forum closed
This forum was closed and turned into an archive effective April 21, 2018. It is no longer possible to create new topics or reply to existing topics.

Thanks everyone for all the great questions and contributions over the years.

Please use the Contact form to get in touch.

Remote Buddy Forum

Overview 

AuthorThread
User

04.07.2010 14:14:30
Activate Behavior Under Applescript
View

This posting is older than 6 months and can contain outdated information.
Hi;

I am using applescript to send commands to iRED to control various pieces of AV equipment, that works fine.

But, how do I switch to a behavior which I have created, after a keypress, which does not launch an application.

For example, I have a button mapped to a AV source which is either PC or Cable, again that works fine.

But when I switch from PC to TV, I need the button mapping to change, so that for example the up button would move up through the cable channels when source Cable is selected, but will revert to the mappings for the individual applications )i.e. front row) when PC is the selected mode.

I'm sure this is very simple, but I have spent a few hours trying to crack it with no success.

Many Thanks

These entries from the FAQ may be relevant to this topic:

Hardware - Apple® Remote
User

05.07.2010 11:44:42
Re: Activate Behavior Under Applescript
View

This posting is older than 6 months and can contain outdated information.
Thanks for asking.

While I can't help you with anything iRed (never used it), here's how you can have Remote Buddy switch to a specific Behaviour via AppleScript:

1) Find out the unique identifier of the Behaviour you want to switch to:

http://www.iospirit.com/support/faqs/remotebuddy/category/7/Developers/entry/183/How-can-I-find-out-the-unique-identifiers-of-Behaviours-and-globally-available-actions/

2) Use the behaviourcore Applescript command to switch to the Behaviour you want, the way you want. From Remote Buddy's AppleScript dictionary:

-- cut -- 
behaviourcore v : Modify Behaviour handling. 
Example: 
tell application "Remote Buddy" 
-- Tell us the name of the currently active behaviour 
behaviourcore accessor "activeBehaviour" 
set theIdentifier to result

-- tell us what the plainName for the Behaviour with the identifier "com.apple.iTunes" is 
behaviourcore accessor "plainName" identifier theIdentifier 
set thePlainName to result

-- tell us where in the menu that Behaviour is located by default 
behaviourcore accessor "defaultMenuAddress" identifier theIdentifier 
set theMenuAddress to result

say "The currently active behaviour has the identifier " & theIdentifier & ". It has the plain name " & thePlainName & ". And you will find it in the menu at address " & theMenuAddress & " by default."

-- Set EyeTV active (as if no other recognized app is running in the foreground and EyeTV had the highest background priority) and make RB stick to the EyeTV Behaviour until the user explicitely deactivates the Behaviour or .. 
behaviourcore accessor "setActiveBehaviour" identifier "com.elgato.eyetv" useActivationEventCode "activatedInBackground" with stickyValue

-- .. we trigger auto recognition of the currently active application and pick the corresponding Behaviour! 
behaviourcore accessor "triggerAutoRecognition" 
end tell

behaviourcore 
accessor text : Command to execute: activeBehaviour (returns the identifier of the currently active Behaviour), setActiveBehaviour (set the active Behaviour to the one specified by the identifier parameter), sticky (active Behaviour remains active until it is manually deactivated), setSticky (can be set to 0 or 1), triggerAutoRecognition (removes any set sticky flag and auto recognizes which Behaviour should currently be active), plainName (human readable name for the Behaviour identified by option identifier), defaultMenuAddress (default menu address, i.e. top.multimedia, top.games, top.system, top.applications, ...) 
[identifier text] : Identifier 
[stickyValue boolean] : If you are using the "setActiveBehaviour" or "setSticky" accessor, you can explicitely define whether the sticky bit is to be set. It is set by default. 
[useActivationEventCode text] : One of activated (behave as if explicitely activated by the user), activatedInFront (behave as if automatically activated because the corresponding application is in front), activatedInBackground (behave as if automatically activated because the frontmost application has no corresponding Behaviour and this Behaviour has the currently highest background priority value). Default is "activated". Optional. For use with setActiveBehaviour only. 
→ text or boolean : Return value depends on value of accessor. 
-- / cut --

Best regards, 
Felix Schwarz 

User

05.07.2010 11:45:21
Re: Activate Behavior Under Applescript
View

This posting is older than 6 months and can contain outdated information.
P.S.: Alternatively, if all you want to do is switch to a particular application (which in turn will trigger Remote Buddy's auto-recognition), you can also use a simple AppleScript à la:

tell application "EyeTV" to activate