Re: [AHK-] 熱鍵送出問題。這樣寫錯在哪?

看板EzHotKey作者 (丹丹)時間15年前 (2010/04/17 17:05), 編輯推噓1(103)
留言4則, 1人參與, 最新討論串2/2 (看更多)
自己修改了一下,現在按 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
在Hoty:上面加一行return
04/17 20:30, 1F

04/17 20:43, , 2F
你寫的非常漂亮 我之前沒想到用A_ThisHotkey
04/17 20:43, 2F
謝謝,問題解決了。 但為何必須要加 Return ,我的 Loop 有限定次數了啊 ※ 編輯: shyangs 來自: 58.114.192.127 (04/17 21:19)

04/17 21:28, , 3F
他執行到了最后一行,因為lable不會讓他停下來
04/17 21:28, 3F

04/17 21:32, , 4F
你去看一下help的the Auto-execute Section
04/17 21:32, 4F
文章代碼(AID): #1BoNdLtF (EzHotKey)
文章代碼(AID): #1BoNdLtF (EzHotKey)