为什么我的自动热键脚本不能正常工作?
Why my Auto hot key script doesn't work properly?
我为 windows 使用 AutoHotkey。我想编写一个脚本,以便通过单击鼠标中键将(我之前复制的文本)粘贴到我计算机上牛津词典程序的搜索栏中。并且当程序的 window 关闭时,在我单击鼠标中键后自动打开 window 并执行我想要的相同操作(将复制的单词粘贴到程序的搜索栏中) .我写这段代码:
MButton::
IfWinExist, Oxford Advanced Learner's Dictionary
{
WinActivate
Click, 182, 133, 2
Send, ^a{Delete}
sleep, 100
Send, ^v{Enter}
}
else
{
Run, "E:\dictionary oxford\OALD9.exe"
WinActivate, Oxford Advanced Learner's Dictionary
sleep, 500
Click, 182, 133, 2
Send, ^a{Delete}
sleep, 100
Send, ^v{Enter}
}
return
当我 运行 代码时,它只执行我想要的第一个任务。当它打开时,它会粘贴到牛津词典的搜索栏中。但是当它关闭时,在我点击鼠标中键后它只是打开程序,并没有将单词粘贴到搜索栏中。
WinWait 是你的朋友。
Documentation
MButton::
IfWinExist, Oxford Advanced Learner's Dictionary
{
WinActivate
Click, 182, 133, 2
Send, ^a{Delete}
Sleep, 100
Send, ^v{Enter}
}
else
{
Run, "E:\dictionary oxford\OALD9.exe"
WinWait, Oxford Advanced Learner's Dictionary,,4
WinActivate, Oxford Advanced Learner's Dictionary
Sleep, 500
Click, 182, 133, 2
Send, ^a{Delete}
Sleep, 100
Send, ^v{Enter}
}
return
编辑:您可能还想考虑 RunWait。 Documentation
我为 windows 使用 AutoHotkey。我想编写一个脚本,以便通过单击鼠标中键将(我之前复制的文本)粘贴到我计算机上牛津词典程序的搜索栏中。并且当程序的 window 关闭时,在我单击鼠标中键后自动打开 window 并执行我想要的相同操作(将复制的单词粘贴到程序的搜索栏中) .我写这段代码:
MButton::
IfWinExist, Oxford Advanced Learner's Dictionary
{
WinActivate
Click, 182, 133, 2
Send, ^a{Delete}
sleep, 100
Send, ^v{Enter}
}
else
{
Run, "E:\dictionary oxford\OALD9.exe"
WinActivate, Oxford Advanced Learner's Dictionary
sleep, 500
Click, 182, 133, 2
Send, ^a{Delete}
sleep, 100
Send, ^v{Enter}
}
return
当我 运行 代码时,它只执行我想要的第一个任务。当它打开时,它会粘贴到牛津词典的搜索栏中。但是当它关闭时,在我点击鼠标中键后它只是打开程序,并没有将单词粘贴到搜索栏中。
WinWait 是你的朋友。 Documentation
MButton::
IfWinExist, Oxford Advanced Learner's Dictionary
{
WinActivate
Click, 182, 133, 2
Send, ^a{Delete}
Sleep, 100
Send, ^v{Enter}
}
else
{
Run, "E:\dictionary oxford\OALD9.exe"
WinWait, Oxford Advanced Learner's Dictionary,,4
WinActivate, Oxford Advanced Learner's Dictionary
Sleep, 500
Click, 182, 133, 2
Send, ^a{Delete}
Sleep, 100
Send, ^v{Enter}
}
return
编辑:您可能还想考虑 RunWait。 Documentation