在autohotkey中并非所有发送标签都有效

时间:2017-03-25 01:31:56

标签: macros autohotkey

我试图制作一个.ahk宏观gif制作,上传和网址应对,但它经常忽略像发送,{tab down} {tab up}这样的按键,完全打破宏。也发送,当我在字符串中间发送它时^ L不起作用

^q::
Run, firefox.exe "gifcreator.me"
sleep 9000
Loop 9
    {
        Send, {tab}
        sleep 100
    }
send, {enter down}
sleep 500
send, {enter up}
sleep 200
Loop 4
    {
    send, {ctrl down}
    send, ^L
    send, {ctrl up}

    }
sleep 200
send {ctrl down}
send, a
send, {ctrl up}
sleep 200
send, {delete down}
sleep 200
send {delete up}
sleep 5000
send, C:\Users\John Reuter\OneDrive\art
sleep 300
send, {enter down}
sleep 500
send, {enter up}
sleep 5000
click 1200, 50
sleep 3000
click 1200, 50
sleep 200
send, {ctrl down}
sleep 200
send, v
sleep 200
send, {Ctrl Up}
sleep 13000
click 50, 150
sleep 3000
send, {Ctrl Down}
sleep 200
send, a
sleep 200
send, {Ctrl Up}
sleep 200
send, {Ctrl Down}
sleep 200
send, a
sleep 200
send, {Ctrl Up}
sleep 7000
send, {enter}
sleep 5000
send, 5
sleep 200
send, 1
sleep 3000
send,^{ctrl down}-{ctrl up}
sleep 3000
send,^{ctrl down}-{ctrl up}
sleep 3000
send,^{ctrl down}-{ctrl up}
sleep 3000
send,^{ctrl down}-{ctrl up}
sleep 3000
send,^{ctrl down}-{ctrl up}
sleep 3000
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 300
send, {down}
sleep 3000
click 567, 227;                    miss
sleep 3000
send, {Ctrl Down}
send, f
send, {Ctrl Up}
sleep 3000
send, download gif
sleep 5000
send, {enter}
sleep 5000
send, {Ctrl Down}
send, l
send, {Ctrl Up}
sleep 5000
send, giphy.com/upload
sleep 3000
send, 2
sleep 3000
click 642, 325
sleep 8000
send, {down} 
sleep 3000
send, {right}
sleep 3000
send, {down}
sleep 3000
send, {right}
sleep 3000
send, {down}
sleep 3000
send, {right}
sleep 3000
send, {down}
sleep 3000
send, {right}
sleep 3000
send, {enter}
sleep 7000
send, {Ctrl Down}
send, f
send, {Ctrl Up}
sleep 3000
send, upload gifs
sleep 3000
click right 661, 198
sleep 3000
click 713, 218
sleep 3000
send, {Ctrl Down}
send, l
send, {Ctrl Up}
sleep 3000
send, {Ctrl Down}
send, x
send, {Ctrl Up}
sleep 3000
send, <img src="
sleep 3000
send, {Ctrl Down}
send, v
send, {Ctrl Up}
sleep 3000
send, "alt=""style="width:12px;height:18px;">
;======================
Esc::ExitApp

2 个答案:

答案 0 :(得分:0)

而不是睡觉,尝试使用WinWait等。查看AHK帮助文件如何正确使用命令(Run,WinWait等)。

SetTitleMatchMode, 2
Run, firefox.exe "gifcreator.me"
WinWait, Online Animated GIF Maker
IfWinNotActive, Online Animated GIF Maker, ,WinActivate, Online Animated GIF Maker
WinWaitActive, Online Animated GIF Maker
sleep 100
Loop 8
{   
    Send, {tab}
    sleep 100
}
Send, {Enter}
; WinWait, ...
; IfWinNotActive, ...
; ...
; SendInput, C:\Users\John\OneDrive\art
; ...

修改

如果在第一个“Send,{Enter}”之后没有出现下一个窗口,请尝试使用循环:

SetTitleMatchMode, 2
Run, firefox.exe "gifcreator.me"
Loop
{
    WinWait, Online Animated GIF Maker
    IfWinNotActive, Online Animated GIF Maker, ,WinActivate, Online Animated GIF Maker
    WinWaitActive, Online Animated GIF Maker
    sleep 100
    Loop 8
    {
        Send, {tab}
        sleep 100
    }
    Send, {Enter}   
    sleep 1000
    IfWinExist,  title of next window
        break
}
; WinWait, title of next window
; IfWinNotActive, ...
; ...
; SendInput, C:\Users\John\OneDrive\art

答案 1 :(得分:-1)

为什么在发送后输入逗号?这不是正确的语法。 AltHotKey网站上的这些示例将是您的命令的正确语法:

Send {b down}{b up}
Send {TAB down}{TAB up}
Send {Up down}  ; Press down the up-arrow key.
Sleep 1000  ; Keep it down for one second.
Send {Up up}  ; Release the up-arrow key.

查看他们的网页,了解有关发送命令的更多详细信息:https://www.autohotkey.com/docs/commands/Send.htm