Merhaba, C#'da Macro Yazıyorum Daha Önce Çalıştırdığım Kodlar Çalışmıyor.
Macro tamamlandı sayılır. Sadece Caps Lock tuşuyla açma kapama kısmında kodların doğru olduğundan eminim neden çalışmadığını anlayamadım, yardımcı olursanız sevinirim.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AutoItX3Lib;

namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{

[DllImport("User32.dll")]
private static extern short GetAsyncKeyState(int vKey);
AutoItX3 key = new AutoItX3();


public Form1()
{
InitializeComponent();
}


private void timer1_Tick(object sender, EventArgs e)
{
key.Send(textBox1.Text);
}


private void timer2_Tick(object sender, EventArgs e)
{
string basilan = "";
foreach (System.Int32 i in Enum.GetValues(typeof(Keys)))
{
if (GetAsyncKeyState(i) == -32767)
basilan = Enum.GetName(typeof(Keys), i);
}
if (basilan == "CapsLock")
{
if (timer1.Enabled == true)
timer1.Enabled = false;
else
timer1.Enabled = true;
}
if (timer1.Enabled == false)
{
label1.Text = "Pasif";
label1.BackColor = System.Drawing.Color.Red;
}
else
{
label1.Text = "Aktif";
label1.BackColor = System.Drawing.Color.Green;
}


}
}
}