This posting is older than 6 months and can contain outdated information.
After looking further through the AppleScript dictionary of Remote Buddy and finding a script on the website that provides the identifiers for the actions I was able to cobble together a script that does the job.
The key to success turned out to be applying a different extension to each behaviour bundle identifier while retaining Safari as the application bundle identifier.
tell application "Safari"
-- make the app change
do JavaScript "toggleApps()" in document 1
-- pick up flag
set appLoaded to do JavaScript "appLoaded" in document 1
end tell
tell application "Remote Buddy"
if appLoaded is "App1" then
-- change the behaviour
behaviouraction actionIdentifier "com.iospirit.remotebuddy.behaviours.switchto.com.mycompanyname.scriptedbehaviours.safari.app1" event "pressed"
-- indicate to user that behaviour has changed and new button assignment
behaviouraction actionIdentifier "com.iospirit.remotebuddy.menu.showmenu" event "pressed"
else if appLoaded is "App2" then
-- change the behaviour
behaviouraction actionIdentifier "com.iospirit.remotebuddy.behaviours.switchto.com.mycompanyname.scriptedbehaviours.safari.app2" event "pressed"
-- indicate to user that behaviour has changed and new button assignment
behaviouraction actionIdentifier "com.iospirit.remotebuddy.menu.showmenu" event "pressed"
end if
end tell
Last edited: 13.09.2015 08:56:02