Jump to content

Pressing a specific keyboard button


infamous11

Recommended Posts

 

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
Share on other sites

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
Share on other sites

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 by infamous11
posted too early
Link to comment
Share on other sites

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 by Marsbar
Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...