Use variable for 'Key' in SendHotKey?

I want to read a list of chars from an excel table, loop these and send the keys using a SendHotKey activity. How can I do that?

I doesn’t look like I can use a datarow pointer or variable in the ‘Key’ property? The output is exactly what’s in the text box.

Can I let it know I’m using code here instead?

Using ‘Type Into’ won’t work since it’s not a text area i’m sending the keys to.

Skärmklipp

Why doesn’t work with Type Into Activity? I have tested here and worked fine.

Have you tried something like this? :

Regards,

4 Likes

I can’t use that activity with the application I’m sending the keys to since they are hotkeys and not a value that’s beeing entered in a text field.

Hi David,

Actually @Lucas.Pimenta’s idea is very good in my opinion becauseyou can use Type into without a selector(so you don’t need a text field). Send Hotkey is an activity which is kind of a particular case for Type into.

This is an example I have found for WriteText method:
text = “AbC[d(ctrl)]a[u(ctrl)k(alt)]”
This sample sequence outputs “AbC”, then holds down (d) the Ctrl key, presses “a” and then releases Ctrl (u) and hits Alt (k = press and release).

k:=synthesize a key down followed by a key up event for the specified key.
d:=synthesize a key down event for the specified SPECIAL_CHARS.
u:=synthesize a key up event for the specified SPECIAL_CHARS.

So after you get your chars from the Excel file you can use string manipulation to make it work like in the example. I hope it helps!

6 Likes

What do you know… Yes, It works! :slight_smile:

I tried it before but probably did a selection first and that way didn’t get the application as target.

Thanks alot!

2 Likes