infamous11 0 Posted February 15, 2019 Share Posted February 15, 2019 Hi! Is there a way for the bot to actually press a specific keyboard button (for example 'n' or numpad 9)? Link to comment https://wrobot.eu/forums/topic/10814-pressing-a-specific-keyboard-button/ Share on other sites More sharing options...
Jensen- 25 Posted February 15, 2019 Share Posted February 15, 2019 robot Manager.Helpful.Keyboard.Press Key(process.MainWindowHandle, System.Windows.Forms.Key.F1); change f1 with the numpad key Link to comment https://wrobot.eu/forums/topic/10814-pressing-a-specific-keyboard-button/#findComment-51571 Share on other sites More sharing options...
infamous11 0 Posted February 15, 2019 Author Share Posted February 15, 2019 I got this error using this "robotManager.Helpful.Keyboard.PressKey(process.MainWindowHandle, System.Windows.Forms.Key.NumPad9);" : : error CS0103: A(z) „process” név nem szerepel ebben a környezetben. In english--> name doesnt exist in this enviroment and error CS0234: A(z) „Key” típus- vagy névtérnév nem szerepel a(z) „System.Windows.Forms” névtérben (esetleg hiányzik egy szerelvényre mutató hivatkozás). --> Key type or namespace does not exist in System.Windows.Forms namespace (or maybe its missing reference). Is it some kind of .NET error? Link to comment https://wrobot.eu/forums/topic/10814-pressing-a-specific-keyboard-button/#findComment-51574 Share on other sites More sharing options...
Droidz 2742 Posted February 19, 2019 Share Posted February 19, 2019 Hello, if you want press key to external program window use code like: Quote var p = System.Diagnostics.Process.GetProcessesByName("ExeFileNameWithoutExtension");foreach (var process in p){ robotManager.Helpful.Keyboard.PressKey(process.MainWindowHandle, System.Windows.Forms.Keys.F1);} Replace ExeFileNameWithoutExtension by file name (without .exe) You can replace F1 by https://docs.microsoft.com/fr-fr/dotnet/api/system.windows.forms.keys?view=netframework-4.7.2 If you want press key to Wow window: Quote robotManager.Helpful.Keyboard.PressKey(wManager.Wow.Memory.WowMemory.Memory.WindowHandle, System.Windows.Forms.Keys.F1); Link to comment https://wrobot.eu/forums/topic/10814-pressing-a-specific-keyboard-button/#findComment-51668 Share on other sites More sharing options...
infamous11 0 Posted February 19, 2019 Author Share Posted February 19, 2019 (edited) 1 hour ago, Droidz said: Hello, if you want press key to external program window use code like: Replace ExeFileNameWithoutExtension by file name (without .exe) You can replace F1 by https://docs.microsoft.com/fr-fr/dotnet/api/system.windows.forms.keys?view=netframework-4.7.2 If you want press key to Wow window: It still gives me a compile error: Quote [E] 12:47:27.026 - Compilator Error : c:\Users\Kiccsi\AppData\Local\Temp\5vor25un\5vor25un.0.cs(23,22) : error CS0246: The type or namespace name 'Forms' could not be found (are you missing a using directive or an assembly reference?) How can I add the System.Windows.Forms.dll to the program as reference, so it could use its namespace? Edited February 19, 2019 by infamous11 posted too early Link to comment https://wrobot.eu/forums/topic/10814-pressing-a-specific-keyboard-button/#findComment-51671 Share on other sites More sharing options...
Marsbar 228 Posted February 19, 2019 Share Posted February 19, 2019 (edited) 12 minutes ago, infamous11 said: It still gives me a compile error: How can I add the System.Windows.Forms.dll to the program as reference, so it could use its namespace? Rightclick references, under the Assemblies category on the left find System.Windows.Forms and tick it in the list Edit: Sorry I misunderstood. Add using System.Windows.Forms; to the top of the file Edit2: Or did i? Edited February 19, 2019 by Marsbar Link to comment https://wrobot.eu/forums/topic/10814-pressing-a-specific-keyboard-button/#findComment-51672 Share on other sites More sharing options...
infamous11 0 Posted February 19, 2019 Author Share Posted February 19, 2019 35 minutes ago, Marsbar said: Rightclick references, under the Assemblies category on the left find System.Windows.Forms and tick it in the list Edit: Sorry I misunderstood. Add using System.Windows.Forms; to the top of the file Edit2: Or did i? Im doing it the quester editor, so adding the using part to the top gives me this error: error CS1529: A using clause must precede all other elements defined in the namespace except extern alias declarations I know I have to add it in VS for it to work, but how do I do that? I mean I did try to do a Questprofile creating a ClassLibrary a while ago but when I when I started the bot through VS, it freezes every time at authentication. It freezes without adding anything only the dll as refrence. So can I open the wRobot in VS to edit it directly, or Im messing something up when I try to run wRobot through VS? Link to comment https://wrobot.eu/forums/topic/10814-pressing-a-specific-keyboard-button/#findComment-51673 Share on other sites More sharing options...
Matenia 630 Posted February 19, 2019 Share Posted February 19, 2019 You can add imports (using derictives) in the Custom Script part of the quester editor or just add a fully qualified name for the classes you're using. infamous11 1 Link to comment https://wrobot.eu/forums/topic/10814-pressing-a-specific-keyboard-button/#findComment-51674 Share on other sites More sharing options...
infamous11 0 Posted February 19, 2019 Author Share Posted February 19, 2019 3 hours ago, Matenia said: You can add imports (using derictives) in the Custom Script part of the quester editor or just add a fully qualified name for the classes you're using. YES! It works that way, thank you!! Link to comment https://wrobot.eu/forums/topic/10814-pressing-a-specific-keyboard-button/#findComment-51680 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now