0

I'm using the 3 finger drag script and another script in the same ahk, the problem is when I'm connected to a mouse at home, I can't use the mouse to drag the file as long as this script is running. I want only the 3 finger drag part of the script is disabled during the period of time that my mouse is connected. Thanks!

My script as follow:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

--zoom with page up and down PgUp:: Send, {CTRLDOWN}{+} PgDn:: Send, {CTRLDOWN}{-}

--3 finger drag #SingleInstance force

drag_enabled := 0

+^#F22:: if(drag_enabled) { Click up drag_enabled := 0 } else { drag_enabled := 1 Click down } return

LButton:: if(drag_enabled) { Click up drag_enabled := 0 } else click return

1 Answer 1

0

You can check the active status of hotkeys with "#if expression".

Examine the #if statement:

"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\mouhid\Enum" in "Count" When the count is 0, it means that there is no mouse attached to the system.

MouseCnt(){ ;Retrieves mouse status data from the registry.
RegRead,MouseC,HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\mouhid\Enum,Count
return MouseC
}
    
#if !MouseCnt() ;When the exclamation point is removed, your shortcuts within this expression will only work when the mouse is attached.
/*
Your hotkeys that will work when the mouse is unpluged.
*/
#if
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry, but I still don't understand where should I put my 3 finger drag script to make it work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.