solano
(Solano)
July 24, 2017, 5:58am
1
Hi!
I am learning around this cool stuff, but cant find any implenetation about Keyboard+Mouse iteraction with client GUI, such as Ctrl+Click.
I have found mouse usage like:
Sanderling.MouseClickLeft(Module);
and keyboard:
Sanderling.KeyboardPressCombined(ToggleKey);
but cant find how do it together simultaneously.
Is it possible?
Strece
July 24, 2017, 6:24am
2
On my first post here let me help bring you in the right direction.
A good source when it comes to Mouse or Keyboard interaction with Sanderling is the API Page on GitHub:
There you can see, that your issue is described as:
Sanderling.KeyboardPressCombined(new[]{ VirtualKeyCode.LMENU, VirtualKeyCode.F4}); // ALT + F4
solano
(Solano)
July 24, 2017, 6:27am
3
No, i need keybord + mouse: ALT + MouseClick, not ALT + Key, for example.
Actualy, i need Ctrl+Click (for lock target faster)
Strece
July 24, 2017, 6:30am
4
Ah my bad, did not read properly.
As I saw in the API and code there is no out of the box solution, you can look at the C# api maybe there have a function to do your task.
Viir
(Michael Rätzel)
July 25, 2017, 11:23am
5
Yes, you can do that by using the KeyDown
and KeyUp
methods to change state of keyboard keys.
The following code should implement clicking with left mouse button while CTRL key is down:
Sanderling.KeyDown(VirtualKeyCode.CONTROL);
Host.Delay(100);
Sanderling.MouseClickLeft(overviewEntryToLock);
Host.Delay(100);
Sanderling.KeyUp(VirtualKeyCode.CONTROL);
Terpla
January 17, 2018, 9:45am
6
A-Bot:
Is it possible to create list of actions for executing in one step?
For example i need Ctrl+MouseClick for locking target.
My realisation:
using Sanderling.Interface.MemoryStruct;
using Sanderling.Motor;
using System.Collections.Generic;
using WindowsInput.Native;
namespace Sanderling.ABot.Bot.Task
{
class LockTargetTask :IBotTask
{
private IOverviewEntry target;
public LockTargetTask(IOverviewEntry target)
{
if (target != null)
this.target = target;
}
public IEnumerable<IBotTask> Component => null;
public IEnumerable<MotionParam> Effects
{
get
{
if (target == null)
yield break;
var ctrlKey = VirtualKeyCode.CONTROL;
yield return ctrlKey.KeyDown();
yield return target.MouseClick(BotEngine.Motor.MouseButtonIdEnum.Left);
yield return ctrlKey.KeyUp();
}
}
}
}
I have 3 steps: Ctrl key down, mouse click, Ctrl key up. Each iteration checks several conditions.
Soo, sometimes my bot have bug:
check conditions
Ctrl key down
check conditions
mouse click
check conditions
But the conditions had changed and “Ctrl key up” action never executed.
1 Like
Viir
(Michael Rätzel)
January 17, 2018, 12:50pm
7
Terpla:
I have 3 steps: Ctrl key down, mouse click, Ctrl key up. Each iteration checks several conditions.
Soo, sometimes my bot have bug:
check conditions
Ctrl key down
check conditions
mouse click
check conditions
But the conditions had changed and “Ctrl key up” action never executed.
This seems a good case to include in the checklist for designing the API for eve online bots. So far, I do not have a solution.
Terpla
January 18, 2018, 10:14am
8
I guess, this enumeration should contain “Lock”
public enum ShipManeuverTypeEnum
{
None = 0,
Stop = 9,
Approach = 10,
Orbit = 11,
KeepAtRange = 12,
Dock = 17,
Docked = 18,
Undock = 19,
Warp = 30,
Jump = 31
}
Terpla:
My realisation:
Whoa. Why is it like this?
I made it that way:
yield return new BotTask
{
Effects = new[]
{
MotionParamExtension.KeyDown(lockTargetKeyCode),
overviewEntryLockTarget.MouseClick(BotEngine.Motor.MouseButtonIdEnum.Left),
MotionParamExtension.KeyUp(lockTargetKeyCode)
}
};
Works fine for me.
PS. how to quote code correctly?
1 Like
Viir
(Michael Rätzel)
January 18, 2018, 10:10pm
10
Terpla
January 19, 2018, 7:39am
11
TheChosenOne:
I made it that way
It’s almost the same things.
Yes, but you doing this in 3 steps while mine works at 1 step and correct. Thats the point.
Terpla
January 19, 2018, 1:11pm
13
As i understand it’s still 3 steps, but not one.
Whatever, bro, i will not share any working parts anymore.