2013-01-08 119 views
1

我正在嘗試(按住左邊的按鈕1秒)以使其執行右鍵單擊。以下是我得到的:如何輸入(保持LButton)?

LButton:: 
    MouseClick, right, , , 1, 0, D 
    Sleep 0 
    MouseClick, right, , , 1, 0, U 
return 

如何將「LButton」輸入改爲「Hold LButton 1秒」?

+0

我想你必須衡量按下鼠標和鼠標了之間的時間。 –

+0

嗯... tbh我不知道該怎麼做:(,而且實際上那個腳本我是從某個地方得到的...... –

+0

一旦我找到了如何執行基本的線程間通信,這應該很容易。調查.. –

回答

1

這個怎麼樣...

LButton:: 
StartTime := A_TickCount ; Set the timer 
KeyWait, LButton ; Wait for release of mousebutton 
ElapsedTime := A_TickCount - StartTime ; Calculate elapsed time 
if (ElapsedTime > 1000) 
    Click, Right ; when longer than 1000 ms 
    Click, Left ; when shorter than 1000 ms 
return 

缺點是你不能使用鼠標例如高亮文本了...

+0

酷!它的作品像一個魅力。謝謝! –

0

在這裏你去:

#Persistent 
#SingleInstance Force 
#NoEnv 
SetBatchLines, -1 

global timeDown = 0 

SetTimer, checkLeftClick,25 

checkLeftClick: 
    if( GetKeyState("LButton" , "P")) 
    { 
     timeDown += 25 
    } 
    else 
    { 
     timeDown = 0 
    } 

    if(timeDown > 1000) 
    { 
     MouseClick , left , , , , ,U 
     Click,Right 
     timeDown = 0 
    } 

return 
相關問題