2016-09-19 52 views
0

所以我試圖尋找網頁上的特定文字和做的事情,如果找到文本,這裏是我當前的腳本:的AutoHotkey如果剪貼板

!m:: 
clipboard = 
text = my text here 
Send, {Ctrl}+A 
Sleep, 100 
Send, {Ctrl}+C 
var1 = %clipboard% 
IfInString, var1, %text% 
msgbox found the text 
else 
msgbox no text found 

而且不管文字上該網頁與否,它總是返回「找不到文字」

對此有何幫助?

P.S.我也試過「如果含有」和刪除線從變量打破,但結果是一樣的:(

StringReplace, var1, var1, `r `n, All 

回答

0

的發送命令是不正確的。

的命令{Ctrl}+A,會按Ctrl,鬆開,然後按A小寫字母也應該使用

您應該使用:。

Send, {Ctrl down}{a}{Ctrl up} 

Send, ^{a} 

對兩個發送命令都這樣做。

一個返回稱道的也應包括爲熱鍵代碼結束 序列:

... 
    else 
    msgbox no text found 
return 
+0

沒有做的伎倆:( – Sparkman

+0

我的壞,其實如果我刪除第二個發送完整,只是去: 發送,{Ctrl}} {a} {c} {Ctrl up} 現在的作品,謝謝!:) – Sparkman

0

試試這個:

!m:: 
clipboard := "", MyText := "Hello World" 
cmds := ["{Ctrl down}", "a", "c", "{ctrl up}"] 
Loop % cmds.MaxIndex() { 
    Send % cmds[A_Index] 
    if (A_index == 2) 
     sleep 100 
} 
MsgBox % clipboard ~= "i)" MyText ? "Found" : "Not Found" 
+0

似乎並沒有工作e ither :( – Sparkman