Re: [AHK-] 熱鍵送出問題。這樣寫錯在哪?
自己修改了一下,現在按 1 會跳出訊息視窗 b
q p
......
不過,有一個Bug,執行腳本後,
什麼鍵都還沒按,就會馬上跳出一個訊息視窗,為什麼?
;調用函式庫,下載網址與用法請見
;http://www.autohotkey.com/forum/topic14881.html
#Include AHKA.ahk
;創造兩個陣列
AHKA_SetDebug(false)
arrBoPoMo := "[1,q,a,z,2,w,s,x,e,d,c,r,f,v]"
arrPinyin := "[b,p,m,f,d,t,n,l,g,k,h,j,q,x]"
AHKA_SetDebug(true)
length := AHKA_Size(arrBoPoMo)
index := 0
;改變鍵盤對應
SendKey(Pinyin)
{
MsgBox, %Pinyin%
; Send %Pinyin%
}
Loop, %length%
{
index = %A_Index%
BoPoMo := AHKA_Get(arrBoPoMo, index)
HotKey %BoPoMo%, Hoty
}
Return ;為什麼必須要這個Return
Hoty:
index := AHKA_Find(arrBoPoMo,A_ThisHotkey)
Pinyin := AHKA_Get(arrPinyin, index)
SendKey(Pinyin)
Return
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 58.114.192.127
※ 編輯: shyangs 來自: 58.114.192.127 (04/17 17:07)
推
04/17 20:30, , 1F
04/17 20:30, 1F
→
04/17 20:43, , 2F
04/17 20:43, 2F
謝謝,問題解決了。
但為何必須要加 Return ,我的 Loop 有限定次數了啊
※ 編輯: shyangs 來自: 58.114.192.127 (04/17 21:19)
→
04/17 21:28, , 3F
04/17 21:28, 3F
→
04/17 21:32, , 4F
04/17 21:32, 4F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):