Mouse Drag n'Drop script problem

Get help with using AutoHotkey and its commands and hotkeys
Posts: 8
Joined: 15 Jun 2019, 06:38

Mouse Drag n'Drop script problem

15 Jun 2019, 06:56

Hi everyone

I needed to make a script to do some drag n drop. The requirement is One key (the end key in my case) to start the script when pressed first time,
when pressed 2nd time to stop the script. And when pressed again, it must start from the begining.
While i did some search on internet, ive found this post (
Which at the begining seems to work ok. But, problem starts when i press the hotkey more than 3 times. Ath the 4th time, it stops working and needs to reload it again.
I tried to replace the Reload command within the IF, but seems to loosing the drag n drop coords.
The whole script is:

Code: Select all

#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.

#SingleInstance, Force

#MaxThreadsPerHotkey 2

Return ;<-- forced end of autoexecute section
; when you press f3 the first time the loop runs.
; when you press it the 2nd time it flips the f3Run flag and stops the loop
; if you press it a 3d time it restarts the loop from the beginning.
   ENDRun := !ENDRun
   If (!ENDRun)
   While (ENDRun)
WinActivate,  ahk_class tooltips_class32
Sleep, 333
SetDefaultMouseSpeed, 8

WinActivate, program-name ahk_class triuiScreen

SendEvent {Click 1252, 891, down}{click 1146, 698, up}

Sleep, 72000



Any advice please?

Thanks in Advance

[Mod edit: Moved to 'Ask for Help' and [code][/code] tags added]
Posts: 8
Joined: 15 Jun 2019, 06:38

Re: Mouse Drag n'Drop script problem

16 Jun 2019, 03:55

Problem Solved.
Just increased the #MaxThreadsPerHotkey up to 100.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Chunjee, Google [Bot], malcev and 40 guests