看板 EzHotKey 關於我們 聯絡資訊
※ 引述《ushenli (ushenli)》之銘言: : 想要用滑鼠左鍵長按 來取代中鍵 : 但只限定在 滑鼠指向的視窗 是chrome的時候生效 : 不然的話 平常就沒辦法用左鍵拖曳檔案了 : 東抄西改後 現在這樣寫 : 不知為什麼 沒辦法限定只在chrome生效 : 想請問應該怎麼改 感謝! : #中鍵不好按中指都快抽筋 : MouseGetPos, , , id, ctrl : if InStr(ctrl,"Chrome") { : $lbutton:: : starttime := a_tickcount : keywait, lbutton : return : lbutton up:: : if (a_tickcount - starttime >= 500) : send, {Mbutton} : if (a_tickcount - starttime <= 500) : send, {lbutton} : return : } 我自己覺得你的想法是可以做到的,但實務上應該還是不太方便,例如反白之類的動作可能 也會出問題。 總之我用「先按著右鍵不放,再按下左鍵」的這個方法來取代中鍵 這樣的話就算是在其他的視窗應該也不太會出事(但下面的範例我還是讓他只在chrome中作用 b := false #If Ms_On_win("ahk_exe chrome.exe") ~Lbutton:: if (getkeystate("RButton", "P")) { sendInput, {Mbutton} b := true return } return $RButton Up:: if(!b) SendInput, {RButton Up} return RButton:: b := false return #IF Ms_on_win(win_title) { MouseGetPos, x, y, ms_win if(WinExist(win_title . " ahk_id " . ms_win)) { ;WinActivate, ahk_id %ms_win% return ms_win } else return false } 希望有幫到你 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 119.14.122.88 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/EzHotKey/M.1606296134.A.AD6.html
ushenli: 謝謝斯馬克大費心 原以為簡單到五六行就可以實現呢 11/26 01:54
ushenli: 按住右+左=中也不錯說 我也只是參考遊戲才想用長按替代中 11/26 01:54
ushenli: 我用了你提供的code 但似乎無法點擊選單 比如 11/26 01:54
把下面WinActivate那行去掉就會正常了,那時候想說這樣可以避免某些問題,但沒想到產生 了更大的問題XD。 ※ 編輯: bhbbbbb (119.14.122.88 臺灣), 11/26/2020 22:48:10