【问题标题】:how to run autohotkey code sequential manner in c#?如何在 C# 中以顺序方式运行 autohotkey 代码?
【发布时间】:2019-10-06 19:20:31
【问题描述】:

我在 c# 中使用 autohotkey.dll。

我想按顺序运行每一步但是

例如我有以下代码和

当达到睡眠时,5000需要等待5秒

但它只是不等待 5 秒,它只是执行 Messagebox.show 对话框。

如何运行每个步骤?

感谢帮助

string scriptContent = @"
WinActivate, chrome
sleep, 5000
"
CoCOMServer ahkThread = new CoCOMServer();
ahkThread.ahktextdll(scriptContent);
MessageBox.Show("hello");

【问题讨论】:

    标签: c# autohotkey


    【解决方案1】:

    等待 ahk 脚本退出:

    string scriptContent = @"
    WinActivate, chrome
    sleep, 5000
    "
    CoCOMServer ahkThread = new CoCOMServer();
    ahkThread.ahktextdll(scriptContent);
    
    while (ahkThread.ahkReady() != 0) // will check evey 100 millisecond if the script still runs
        Thread.Sleep(100); 
    
    MessageBox.Show("hello");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-12
      • 2015-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多