Answer the question
In order to leave comments, you need to log in
Macro KeyDown Delay KeyUp how to make such a macro in C#?
I decided to make a macro of keystrokes, I want to do something like that, press the button, then pause for a few seconds and release the button, then click on the key, too, after a certain number of seconds and again press the pause key and release the button. And that all this would be done while the variable == True
In general, I don’t know how to make pressing and lifting from the button. Here is the code by which I made True or False
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespaceWindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int count = 1;
bool job;
private void button1_Click(object sender, EventArgs e)
{
count++;
if (count % 2 == 0)
job = true;
else if (count % 2 == 1)
job = false;
label1.Text = job.ToString();
}
void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == (char)Keys.F5)
{
button1.PerformClick();
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question