Midi to outgoing keypress translators apple script

…would anyone have a example apple script, in which i could send a outgoing keypress to a running application…
at present, my BM translators require focus of the application in order for it to execute the necessary action.
If anyone has an example apple script… this would be greatly appreciated
cheeRs

Here is an example script that might help. For me, I usually just use the Bome outgoing action to set focus to the desired application. I’m not a heavy AppleScript user. I wrote this script a few years ago just as a test.

tell application "Terminal"
	activate
	my execCmd("ls")
end tell

on execCmd(cmd)
	tell application "System Events"
		tell application process "Terminal"
			set frontmost to true
			keystroke cmd
			keystroke return
		end tell
	end tell
end execCmd

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Awesome!! I will give this a go
thanks again SteveC
cheeRs

hi Steve… i tried the above script but without success, however i did make a shortened version

i used this short version & then use a second translator to send off the keystroke

tell application ‘System Events’
tell application ‘VirtualDJ.app’
activate
end tell
end tell

and a Keystroke translator to activate the necessary midi to keystroke command via outgoing keystroke action…
so basically two mappings
1 application focus
2 keystroke

is there a way in Bomes to apply this application focus translator across all translators within a given preset…
it would be a right pain in the rear… to map out every single translator??
is this possible

as it stands at the moment… i would always press a single midi button to grab focus first… but ideally i’d prefer that the assigned midi button i press activates both application focus & the corresponding keystroke… without the need for making a translator for every single mapping i have done thus far… :-s

Yes, please see the attached example.
The first translator will provide focus to textedit application on any note-on MIDI CH1
The subsequent translators will send a given keystroke with a 10 ms delay depending on the incoming note message sent.

Focus-Keystroke-Example.bmtp (1.2 KB)

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

i see!!..
it did not occur to me to try that *smiles
thanks again!!

1 Like

Hi steve,
could i please get your assistance again

when using the example you provided… i changed the note value to a CC to activate(focus) a application upon pressing a midi button to keypress
raw midi B0 pp 7f ‘activate application’

could you please help me to define the rule set needed to keep the CC number range to be within 1 to 8…
so that the translator within my presets… is isolated to just that CC number range

Here you go. Changed the translators from Note to CC with value of 7F
Added rules to the first translator to limit it.

if pp<1 then exit rules, skip Outgoing Action
if pp>8 then exit rules, skip Outgoing Action

Here is the update project file.
Focus-Keystroke–CC-Example.bmtp (1.3 KB)

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

thank you Steve!!