How move mouse? (no mousemove)
-
- Posts: 2
- Joined: 15 Apr 2022, 08:01
How move mouse? (no mousemove)
Hello, I want to move the cursor to a given place, I did it with "mousemove" but when I switched to the second windows account, this function does not work for me.
Re: How move mouse? (no mousemove)
Ensure that the script is running. By default, coordinates are relative to the active window. You can post your script here for feedback about it.
-
- Posts: 2
- Joined: 15 Apr 2022, 08:01
Re: How move mouse? (no mousemove)
Code: Select all
#NoEnv
#SingleInstance Force
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
SetKeyDelay, 10, 50
; Nie zapomnij przełączyć się na inne okno przed wystartowaniem kopania
; Domyślnie ustawienia:
; F5 - Start
; F6 - Koniec
MainLoop(){
stoniarka := 250
while 1
{
Loop, 23 ; <- Okrążenia przed wpisaniem komend
{
MouseHold() ; przytrzymaj myszkę
SendKey("d", stoniarka*6)
SendKey("s", stoniarka*1)
SendKey("a", stoniarka*6)
SendKey("w", stoniarka*1)
MouseRelease() ; puśc myszkę
}
; Komendy
Command("repair", 80)
Command("sklep", 80)
Sleep 50
MouseMove, 859,441,
SendInput {LButton}
Sleep 500
MouseMove, 860,367,
Sleep 20
SendInput {MButton}
Sleep 500
MouseMove, 966,548,
Sleep 20
SendInput {LButton}
Sleep 500
MouseMove, 968,476,
Sleep 20
SendInput {LButton}
Sleep 500
MouseMove, 859,405,
Sleep 20
SendInput {MButton}
Sleep 500
MouseMove, 896,403,
Sleep 20
SendInput {MButton}
Sleep 500
MouseMove, 931,403,
Sleep 20
SendInput {MButton}
Sleep 500
MouseMove, 969,403,
Sleep 20
SendInput {MButton}
Sleep 500
MouseMove, 1003,403,
Sleep 20
SendInput {MButton}
Sleep 500
MouseMove, 1039,403,
Sleep 20
SendInput {MButton}
Sleep 500
MouseMove, 1074,403,
Sleep 20
SendInput {MButton}
Sleep 500
SendInput {Esc}
Sleep 500
; Opóźnienie komendy
; Sleep 3000
}
return
}
; Start
F5::
global okna_minecrafta
WinGet, hwnd_list, List, Minecraft
okna_minecrafta := Array()
DllCall("LockSetForegroundWindow", Int, 1) ; Lock
Loop, %hwnd_list%
{
hwnd := hwnd_list%A_Index%
okna_minecrafta.Push(hwnd)
DllCall("SetForegroundWindow", UInt, hwnd)
}
MainLoop()
; Zakończ
F6::
Reload
KeyDown(key, hwnd){
WM_KEYDOWN := 0x100
PostMessage, %WM_KEYDOWN%, %key%, , , ahk_id %hwnd%
}
KeyUp(key, hwnd){
WM_KEYUP := 0x101
PostMessage, %WM_KEYUP%, %key%, 0xC0000000, , ahk_id %hwnd%
}
SendKey(key, t:=50){
global okna_minecrafta
if key is not integer
{
StringUpper, key, key
key := ord(key)
}
for index, hwnd in okna_minecrafta
KeyDown(key, hwnd)
Sleep %t%
for index, hwnd in okna_minecrafta
KeyUp(key, hwnd)
Sleep 50
}
MouseHold(){
global okna_minecrafta
WM_LBUTTONDOWN := 0x201
for index, hwnd in okna_minecrafta
PostMessage, %WM_LBUTTONDOWN%, 1, , , ahk_id %hwnd%
}
MouseRelease(){
global okna_minecrafta
WM_LBUTTONUP := 0x202
for index, hwnd in okna_minecrafta
PostMessage, %WM_LBUTTONUP%, 0, , , ahk_id %hwnd%
}
Command(command, t){
SendKey(0xBF) ; SLASH
Loop, Parse, command
{
SendKey(A_LoopField, t)
}
SendKey(0x0D) ; ENTER
DllCall("ClipCursor")
}
; Kopacz by Gizaar
; edit by Gienkoskyy
- Attachments
-
- kopanie w tle.ahk
- (3.67 KiB) Downloaded 28 times
Re: How move mouse? (no mousemove)
Although the meaning of "this function does not work for me" is not provided, it looks like you need a debugging strategy. Here would be mine.
1. Shorten the script, so that you can test one section at a time.
2. Remove the loops, so that you can test single iterations.
3. Follow the script line by line, to try to understand what happens at every step.
4. Display the values of your variables (or use ListVars, etc.)
5. Display the values of your conditional statements (e.g., If...).
This approach may help you to pinpoint the problem.
1. Shorten the script, so that you can test one section at a time.
2. Remove the loops, so that you can test single iterations.
3. Follow the script line by line, to try to understand what happens at every step.
4. Display the values of your variables (or use ListVars, etc.)
5. Display the values of your conditional statements (e.g., If...).
This approach may help you to pinpoint the problem.
-
- Posts: 2
- Joined: 04 Apr 2022, 07:19
Re: How move mouse? (no mousemove)
“It's called a mouse mover and it moves your mouse while you're away so you can go to the bathroom free from paranoia,” she explains. Mouse movers are small devices that go under a computer's mouse (not a laptop trackpad) and keep the cursor active without any human interaction.