how to output value of variable as Outgoing > Key Stroke > Text?

0
0

Hi!

I’m trying to output the value of a variable as text (Outgoing -> Key Stroke -> Text). Just putting the name of the variable (ex. “ga”) in the Text field doesn’t work. How do I do this?

Background:

I have a controller with finite encoders that output 0…127. I have a program (Photoshop) that wants 0…100, ex. Opacity. I target the Opacity field in Photoshop with injected mouse click. I then scale 0…127 to 0…100 with rules and try to output the calculated value as Key Stroke -> Text, but it doesn’t work.

I have endless encoders too, and I can use them to output Up or Down key strokes, but I’m thinking the 0…127 encoders might feel nicer in this case.

Thanks a ton,

Minja

Marked as spam
Posted by (Q&A Forum: 1, Answers: 4)
December 1, 2017 3:07 pm
68 views
0
Private answer

OK, outputting numbers as digits from MT Pro is not a trivial task, but I managed to create an example with timers. I hope this helps anyone out there that might need it.

First you turn the knob to build your output digits 0-127 from the incoming controller. Translator is called “Build Digits”,

Then you set up a separate button to transmit the digits. I had to do this because if I tried to do it with the same knob, it kept stepping over itself and I had incomplete digits. Translator is called “Execute”

Execute fires of a timer to set digits 1 at a time to another timer called “Digit Timer”

There are 11 translators that monitor for “Digit Timer”. Each translator puts out a key stoke if the number seen is their keystroke, otherwise nothing happens.  These translators are number 0-9 and <Return>

Global variable gb is the value captured from the controller.

g1= is the 100’s digit

g2= is the 10’s digit

g3= is the 1’s digit

then the value 13 if for the <return> key

The Execute button sets a timer which handles the iterations of output

g1 g2 g3 and 13 <return>

What you will need to modify:

Value of your incoming knob “Build Digits”

Value for your execute button “Execute”

And of course if you are using any of the below global variables you may need to change them so they don’t conflict with your current project

ga=outgoing digit value, gb=controller value, gc=number timer iteration counter, g1, g2, g3 (described earlier)

 

For outgoing keystroke values, I chose Windows Scan Code values. Most are equivalent to ASCII.

Steve Caldwell

Marked as spam
Posted by (Q&A Forum: 22, Answers: 1131)
December 11, 2017 10:46 pm
0
Private answer

Hi Steve!

Thanks again for your help and generosity!! And thanks for all the usefull information and tips too. And thanks for teaching me how to use the timers!

I did more digging around, this time in C1.

As a background:
The reason I had the idea of using midi controllers in the first place is that there are scenarios where being able to adjust two controls at the same time would be really useful. Those are:
– adjust contrast and saturation at the same time (because in RGB adjusting contrast affects saturation)
– adjust vertical (or horizontal) keystone and rotation at the same time (because with those you may have to go back and forth several times to get it right.)

Of course to be useful, the feel would have to be good as well, especially for the geometry correction. I am lucky enough to have a huge A3 Wacom, which is quite precise (slow pointer movement) with 27″ screen. But I’d love to move two things at the same time.

Good news first:

I can confirm that many C1 sliders are totally controllable by using keyboard shortcuts via Bome, as you suggested! Those include: White balance, Exposure, Contrast, Saturation, Clarity and some others. But we allready knew this, and in fact this person and many others have figured this all out:

https://phodograf.com/controller-1/

So yes, I was able to adjust contrast and saturation at the same time and the experience was fluid and responsive.

Then the bad news:

If you look at Phodograf’s mapping, you see that they didn’t map Rotation or Keystone at all.

After digging around more, this is what I believe:

Capture One is midi-uncontrollable when it comes to Rotation and Keystone. 🙁

In case of Rotation, the reason is the ridiculously large step of 1 degree that the keyboard shortcut has. I can visually tell if an image is about 0,3 degrees not straight. So a step of 1 deg is HUGE. Thus the keyboard shortcut is useless. I did test this as well.

The workaround doesn’t work either: With rotation, the Up/Down buttons have a step of 1/10 degree, which is perfect. However, focusing by mouse click injection doesn’t work at all in C1 requiring focusing by coordinates. That requires that the rotation text field is visible and in same place every time. Also, it is possible to adjust only one control at a time using this method as the mouse can only be in one place at a time. Adjusting rotation this way would be sorta acceptable though, if Rotation was the only one that needed the mouse pointing. That is if Keystone could be controlled by keyboard shortcuts. However, it can’t:

In case of vertical and horizontal Keystone, the keyboard shotcuts have a step of 0,01, promisingly small! To speed it up, you can send several keyboard shortcut keystrokes per one midi controller event. Or so I thought. In reality C1 insist on rendering every step on the way (0,01, 0,02, 0,03 …) which is very slow. In fact so slow, that it takes several seconds to get from 0,00 to any realistic number, like 2 or 5. Also, you can’t interrupt it, so you end up waiting several seconds for it to reach the target. So, no way to make keyboard shotcuts work for Keystone.

I tried controlling Keystone with pointing, clicking and dragging the mouse to get an appropriate speed. That’s not relative, however, so you would have to get it right at a one try or start from the beginning. Thats’ really not how fine tuning perspective correction works, from a human perspective. (Bome doesn’t know the location of the slider at the beginning so the drag allways starts from the center). Entering numbers to the field (like you tought me to do with Photoshop) has the same problem of being absolute, not relative as it should in this case. And once again the mouse can only be at one place at a time, making it not possible to adjust vertical keystone and rotation at the same time, which is the original goal here.

None of this is Bome’s fault of course.

Fun fact: at the moment even the “official” Tangent solutions for C1 (350-3500e) don’t support adjusting Keystone. I haven’t tried Palette Gear, but their site says C1 works in “keyboard mode”. So maybe as of 2017-12-01 no hardware solution exists to control C1 Keystone (vertical or horizontal) and Rotation.

TL:DR;
C1 is nicely and easily mappable for many usefull functions, therefore actual speed up of workflow is possible for many people. However, the functions that I was interested in can’t be mapped at all.

Photoshop, in the other hand, is really nice with absolute 0…127 pots mapped to sliders like Layer Opacity and Brush Hardness. Doing this mapping is super cumbersome though, because Bome doesn’t allow outputting values of variables at this time, allthough it seems learning to edit .bmtp files with a text editor might make this easier.

Marked as spam
Posted by (Q&A Forum: 1, Answers: 4)
December 2, 2017 12:34 am

Interesting, I’m going to look into outputting values via MIDI with my MIDIBuddy program. The thought is to be able to take these values and apply them as vk codes to Windows so that we could use a single translator to effect multiple output keys. Right now it is just a pre-drawing board exercise that I’m thinking of. So far, there is only one way communications (except for a few shortcuts) between MIDIBuddy and MT Pro via Sysex.

https://polychoice.wixsite.com/midibuddy

( at December 2, 2017 2:30 am)

Interesting! Allthough I must admit I dont’t understand much of the above.

I took a look at what Virtual-Key Codes are and also MidiBuddy. I and roughly know what Sysex are.

What do you mean by “multiple output keys”? I’m not sure I even understand which problem you are trying to solve, but I’m sure you’re on to something! 🙂

( at December 2, 2017 6:17 pm)

My thought is to have a value transmitted to MIDI buddy as a vk code and then from there invoked in Windows.
That way one translator could handle multiple key outputs instead of a separate translator for every separate key.

( at December 2, 2017 6:26 pm)

I put in a feature request via C1 support to make it possible to properly control C1 from midi. I’m not sure that they will implement it soon or perhaps ever. So in the mean while:

Should we perhaps ask the Bome midi translator devs if they’d find it a good idea to make it possible to use variables in “text” type output? Wouldn’t that be easier than adding yet another program to the mix? I’m pretty sure I’m not the only person out there who’d like to be able to output the value that a variable holds.

( at December 7, 2017 4:26 pm)

Hi, I forwarded your request on to the Bome Development Team.

Steve
bome@sniz.biz
Independent Bome Programming Specialist
Bome Q&A moderator

( at December 7, 2017 5:06 pm)

Hi, we have already on our TODO list the feature to use variables in Keystroke actions. However, I believe you can do everything with the existing MIDI Translator, by adding more translators.
What I mean: using variables in the outgoing keystroke action is merely an optimization, but not a feature that would actually add any functionality.

Also, have you tried injecting mouse movements to C1? Injected mouse events often require a bit of trial&error to set up, but then they are extremely useful…

( at December 10, 2017 2:22 pm)

Great to hear that you have it in your TODO! That optimisation avoids having to manually add several thousand translators. I imagine the effect this has must be tremendous in large projects.

Well, I tried targeting the text fields in C1 by injecting mouse clicks. I tried clicking the actual field, the slider right next to it and the surrounding area. None of those work. I did this by clicking “capture” in Bome and then clicking at the various places in C1. If there’s something else I can do, am glad to try it!

( at December 11, 2017 12:14 pm)

Also, is there a way to know if mouse click succeeded? Like:

if (mouse click worked)
do whatever you wanted to
else
do nothing

I saw an ERROR in the log window once when a mouse click failed, so it seems Bome already knows if the mouse click went through.

( at December 11, 2017 12:20 pm)

Hi, from your rules, you cannot find out if an outgoing action succeeded. If the Log Window shows an error, it is most likely because it cannot “find” the window which you have selected with the Capture function. I’m afraid this usually means that the application (C1) cannot be controlled via injecting.

( at December 11, 2017 2:36 pm)

Hi!

I see.

I actually came across this when trying to control Photoshop. Layer Opacity (in layers palette) is active (not grayed out) only when a non-locked Layer or Adjustment Layer is selected. So it is grayed out when Background layer is selected.

So I injected a mouse click to focus the layer opacity text field. Then CTRL-A to select whats in it, then input the number that I wanted. (A finite 0…127 pot mapped to range 1…100 by dividing by 1.27) Then after 100ms delay send Enter to defocus the text field, as Photoshop cannot really be used while a text field is in focus.

The thing is, if Backgound is selected, or the Layer Opacity field cannot be focused for some other reason, I end up with the whole document selected, as that’s what CTRL-A does. I could avoid stuff like that if I knew if the click succeeded.

( at December 11, 2017 3:27 pm)
0
Private answer

This is the current status of my project… just in case my explanation is difficult to follow.

Marked as spam
Posted by (Q&A Forum: 1, Answers: 4)
December 1, 2017 6:53 pm
0
Private answer

Here you go.

 

Marked as spam
Posted by (Q&A Forum: 22, Answers: 1131)
December 1, 2017 4:11 pm

Hi Steve,

Thanks a lot!!!!

I played around with your example. I believe I might be able to develop this into a solution.

So how do I scale this up? (I tried checking the manual but I didn’t find much on this.)

This controller has 8 finite pots (+ 3 endless). Some have 16 or more. Photoshop and Capture One combined, I might end up mapping 20+ pots in the future.

What should I do when I want to map another pot for another function, say Brush Hardness?

I found that timers seem to be global. I tried duplicating the preset that holds this. But changing only CC# that it reacts to is not enough, I seem to need to create new timer names, and manually change the timers that the 100 Note Timers react to.

My other question is, is there a way to stop execution if one action failed? The program seems to know if something succeeded, because I saw and ERROR in the log window once when a mouse click failed. Specifically, I’d like to know if selecting a field (layer opacity) in Photoshop by injected mouse click succeeded. That’s because that field is grayed out if no layer is selected, and running any of the later things is not a good idea in that case.

( at December 1, 2017 6:47 pm)

Well now that I showed you how to do numbers and injected clicks/keystrokes , I really don’t think that is the best solution for you. For each function, you may need to send injected keystrokes to a different control which means more translators. Also different global variables for each parameter.

I suggest instead you either use assigned Photoshop (or Capture 1) shortcuts or if possible, assign your own for each parameter you need to adjust. The shortcuts should be simple Up/Down keystrokes like “+” and “-“.
Then use endless encoders to convert up/down movement to they respective keystrokes.

Of course if you run out of individual keys, you could use key combinations or maybe even function keys

This is your choice on how much it would take to create/manage. If all you are doing are number 0-9 (no alpha) then you would have 9 injected keystroke translators and one global variable per function. It may be simpler just to have different key definitions for each which would just be 2 (1 for up and 1 for down) plus a global variable.

As far as scaling, it is a matter of copying the presets and then tweaking the values for each. Very manual. I’ve heard you might get away with editing the bmtp project file with a text editor, but I’ve never had much success with that. (make a backup copy if you want to attempt this)

Also, if you are developing for both Photoshop and Capture One, I suggest you do them in separate project files. Primarily for manageability. May not be possible if user wants to use both applications concurrently.

Timers are global and if you use them you need to pass data to them via global variable. They can have local variables within, however. If two timers have the same incoming action the local variable is common to both (not private)

I know of no way to conditionally stop executionif an outgoing action fails, however there is a checkbox you can check if you do not want translators further down the list executed. It is titled “Stop processing after executing this translator”.

I’ve not done a lot with injected keystrokes or mouse actions as I have found that due to the implementation of a given application, it is not always reliable. With that said, usually I find that if an injected action works somewhere within an application, it is likely to also work elsewhere in that same application.

I hope this helps!

Steve

( at December 1, 2017 7:22 pm)
0
Private answer

Hi Minja,

At this time, it is not possible to output keystrokes as values. I suspect this is probably because different platforms encode them differently (ie ASCII single byte  Unicode Double Byte etc). I think in Windows they are actually a combination of scan codes (sc) and virtual keys (vk).

So the only way I would know how to do this is to look at the incoming and then set some sort of “keystoke” timer, that triggers a number of different timer translators simultaneously. Each translator, would then evaluate if it was meant for it and if not, ignore the outgoing action. So out of say 100 translators, each looking for a different value, only one would actually produce output (if the value was targeted for that translator).

If you want, I can put together a short project file to illustrate it (with maybe only 2 or 3 timer translators).

Steve

bome@sniz.biz

Independent Bome Programming Specialist

Bome Q&A moderator

 

 

Marked as spam
Posted by (Q&A Forum: 22, Answers: 1131)
December 1, 2017 3:26 pm

Oh it can output (at least integers) just fine. If I manually enter say “17” to Outgoing -> Key Stroke -> Text, “17” does appear in Photoshop’s Opacity field. According to manual, almost any string will work. The manual says it’s a good way of outputting international characters and such.

Apparently it’s just the values of variables that can’t be output as text?

Do I understand you correctly? :
Make 100 translators with hard coded 1, 2, 3, etc Text outputs
Trigger those with 0 delay timers
Make each one check if it should fire based on the input from controller

A short example file would be great if that’s not too much work!! 🙂

-Minja

( at December 1, 2017 4:04 pm)

Hi Everyone, I’m new on this forum. Like Minja I want to use opacity with my knob. I know that the shortcuts in photoshop to increase and decrease the opacity are :

enter + up arrow and enter + down arrow

Is it possible to set up boom with those shortcut ? I’m trying but I’m a nubbie…

Winston

( at December 10, 2017 6:21 pm)

Hi Winston. Please post a new request for this and in the request indicate the type of MIDI controller you have for input and the input values you would like to use to do this. Hint, it is easier to program if you have endless rotary encoders, but it can also be done with a bit more programming with absolute controllers.

Steve Caldwell

( at December 10, 2017 7:22 pm)