How to implement Ctrl+click & Ctrl+Shift+click event in a C# project/scrip?

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?

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

No, i need keybord + mouse: ALT + MouseClick, not ALT + Key, for example.
Actualy, i need Ctrl+Click (for lock target faster)

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.

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);

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

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.

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
    }

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

Like this:

```c#
code
```

https://meta.discourse.org/t/syntax-highlighting-of-code-blocks/7242/3?u=viir

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.

As i understand it’s still 3 steps, but not one.

Whatever, bro, i will not share any working parts anymore.