Closed neoxeo closed 5 months ago
@neoxeo
BTW If you find SendKeys analogue in WxWidgets I will add this feature much quicker.
@generalloki
I will looking for that and give you results.
@generalloki
Interesting links : Edit: https://docs.wxwidgets.org/trunk/classwx_u_i_action_simulator.html https://github.com/lucassklp/Desktop.Robot/tree/main https://github.com/lallousx86/SendKeys
@neoxeo
Thanks! I beleive I can import wxUIActionSimulator. They write that this class currently doesn't work when using Wayland with wxGTK. But, anyway this would be a simplest solution
Added UIActionSimulator. And example is in 'Samples' page of ControlsSample, 'Action Simulator Sample'. It works ok on Windows and Ubuntu 20.
@generalloki
Thanks a lot !
@generalloki
OS : Windows
Version : 0.9.516
I have questions about SendKeys, SendChar and NativeKeyCode and Keys.
Here is my tool to test them :
And project : Tests_SendKeys.zip
I don't understand why sendchar does not accept "Keys.V" but only "NativeKeyCode" I don't understand why "simulator.SendKeyDown(NativeKeyCode.ControlV);" doesn't send "CTRL+V" I don't understand why KeyUp and KeyDown not have same works SendText have problem when you send text with numbers or special char
Thanks for sending the test project. After studying it:
An example:
var condition = true;
simulator.SendMouseMoveIf(ref condition, button1, (5, 5));
simulator.SendMouseClickIf(ref condition);
simulator.SendMouseMoveIf(ref condition, editor, (5, 5));
simulator.SendMouseClickIf(ref condition);
simulator.SendTextIf(ref condition, "Hello");
simulator.SendMouseMoveIf(ref condition, button2, (5, 5));
simulator.SendMouseClickIf(ref condition);
Clipboard.SetText($"({++counter}) Text from clipboard using Ctrl+V");
editor2.Focus();
editor2.Text = string.Empty;
simulator.SendKeyIf(ref condition, NativeKeyCode.V, UIActionSimulator.KeyModifier.Control);
return condition;
As to your questions:
The major problem is that Ubuntu 23 and maybe other version is not supported and we can just wait until wxWidget add it's support.
I will post an update to action simulator on these days and let you know here when it's uploaded.
Update is in Master
@generalloki
Thanks a lot for all these new options. I have updated testProject and all work fine, except SendText (but you have explained why) and SendKeyUp.
Here is the new TestProject : TestProject2.zip
I beleive SendKeyUp works as expected. You should not use it without SendKeyDown. All controls suppose to receive KeyDown first and only after that KeyUp. So it is better to use SendKey and don't bother with all these.
Ok, if though that KeyUp should work like down. Now, I will only use SendKey.
Do you want to keep this issue opened to solve Send text when WxWidget fix it ? Else, it can be close.
Thanks.
I beleive we can close it for now, as any improvements in wxWidgets simulator part will be reflected automatically when we switch to new wxWidgets version.
@generalloki
Could you add SendKeys (https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys?view=windowsdesktop-8.0)
Thanks