我的日常工作是在两台显示器上打开两个Chrome窗口,在右侧窗口复制数据并将其粘贴到左侧窗口。
此脚本有时无法切换到其他窗口。我知道有一个名为 WinActive 的命令,但我使用相同的程序(谷歌浏览器),所以我不知道如何编写此命令的脚本。
请帮我解决,它非常不稳定。
1:: ; Copy name, change Capital then separate Last and First
Send, {CTRL DOWN}c{CTRL UP} ; Copy data
sleep, 20
send, {Alt Down}{TAB}{Alt Up} ; switch to the other Chrome window
sleep, 20
send, {CTRL DOWN}f{CTRL UP}
SendInput First ;This is how I find the box to move the cursor to click on it
sleep, 5
PixelSearch px, py, 0, 95, 1132, 1019, 0x3296ff, 3, Fast ; Find the color (of the First above)
MouseMove, %px%, %py% ; move mouse to color coordinates
Click
Send, {CTRLDOWN}v{CTRLUP}
send, ^a ; Select all text in the box
Clipboard := "" ; Change capital letter and remove middle name
Send, ^c
ClipWait, 0
If ErrorLevel
Return
Sleep, 50
StringUpper str, Clipboard, T
head := SubStr( str, 1 , 1 )
tail := SubStr( str, 2 )
Clipboard := head RegExReplace( tail , "i)\b(de|an|and|in|the|with|of)\b", "$L1")
Clipboard := RegExReplace(Clipboard, "([A-Z][a-z]+) [A-Z][a-z]{0,2}\. ([A-Z][a-z]+)", "$1 $2")
Send, ^v
Send, {CTRL DOWN}{SHIFT DOWN}{LEFT DOWN}{SHIFT UP}{LEFT UP}x{CTRL UP} ; Copy last name
Send, {SHIFT DOWN}{TAB DOWN}{SHIFT UP}{TAB UP}{CTRL DOWN}v{CTRL UP}{TAB}{TAB} ; bring last name to upper box, then move to the third box
return
非常感谢您的阅读和时间!