我試圖讓AutoHotkey對從剪貼板分配的變量進行求值,然後根據變量做些什麼。下面的代碼:無法獲取AutoHotkey來評估if語句中的變量
^j::
Clipboard := "" ; Must start off blank for detection to work.
WinActivate, ahk_exe Excel.exe
Send, ^c ; Copy text into Clipboard
ClipWait, 2 ; wait for it to be copied
Course := Clipboard ; Fetch the text into variable
Clipboard := "" ; Reset Clipboard
MsgBox %Course% ; To test is Course is "103"
if (Course == 103)
{
Correct_Num := 105
Correct_Title := Art Appreciation
}
send, {Tab}
send, {Tab}
send, {Tab}
send, %Correct_Num%
send, {Tab}
send, %Correct_Title%
if語句沒有檢測到Course == 103
儘管顯示103,我試着寫在報價與103的聲明中MSGBOX,我已經試過IfEqual
。不知道還有什麼要做。
代碼爲我工作。你必須複製一些不是'103'的東西。也許是在2501或者 – 2501
。當我將變量Course打印到消息框中時,它讀出爲103.AHK沒有辦法調用某個整數嗎?它確實看起來像103 –
事實上,當我在Notepad中註釋掉了'WinActive'並使用'103'時,它確實有效。我會看看是否可以將Excel中的單元格格式化爲數字,但它應該已經是我想的 –