-
Posts
332 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
VAN0's Achievements
-
Making a cookie clicker game but wanted some ideas ^^
VAN0 replied to satanttin's topic in AutoIt General Help and Support
Seems to be a bot... -
Remap right mouse dragging as left mouse dragging?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
It seems at least on my system, when I execute MouseDown() or MouseUp() functions from within mouse event handler function, it makes my system unusable. So, as a work around, I tried move everything into main loop, which seems to "work", however OrcaSlicer ignores CTRL+ALT combinations for some reason, but right click now rotates the world even though there is 10ms delay and it still pans the world for a few pixels too: ;~ #include <_debug.au3> #include <Misc.au3> #include <MouseOnEvent.au3> Global $isSecondary = false Global $isDragging = false Global $dragging = false ;make sure we only execute functions once Global $doDown = false Global $doUp = false Func debug($text) ConsoleWrite($text & @CRLF) EndFunc Func _secondaryDown() $isSecondary = true debug("_ mouse down") EndFunc Func _secondaryUp() debug("_ mouse up") $isSecondary = false $return = 0 if $isDragging Then debug("dragging is stopping") $doUp = true elseif $dragging Then debug("dragging stopped" & @CRLF) $doUp = false $dragging = false $return = $MOE_BLOCKDEFPROC ;Block EndIf $isDragging = false return $return EndFunc Func _mouseMove() If $isDragging Or Not $isSecondary Then Return debug("_ mouse move") ;~ Send("{CTRLDOWN}{ALTDOWN}") $isDragging = true $dragging = true $doDown = true debug("dragging started") EndFunc Func doUp() debug("do up") $doUp = false MouseUp($MOUSE_CLICK_PRIMARY) Send("{CTRLUP}{ALTUP}") MouseUp($MOUSE_CLICK_SECONDARY) EndFunc Func doDown() debug("do down") $doDown = false Send("{CTRLDOWN}{ALTDOWN}") MouseDown($MOUSE_CLICK_PRIMARY) EndFunc ; Set events _MouseSetOnEvent($MOUSE_MOVE_EVENT, "_mouseMove") _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT, "_secondaryDown") _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_secondaryUp") ; Idle While 1 if _IsPressed("1B") Then ExitLoop ; ESC if $doDown Then doDown() if $doUp Then doUp() Sleep(10) Wend ; Reset events when done _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT) _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT) _MouseSetOnEvent($MOUSE_MOVE_EVENT) P.S. Any help is highly appreciated, the OrcsSlicer has portable version without installation in case someone is willing to try. -
I'm trying remap dragging with right mouse button in OrcaSlicer so it would do the same as CTRL+ALT+LeftMouse. I was successful with using logitech software for my mouse, however it removed simple right click capabilities. So autoit for the rescue, I hope. So far, I come up with this code which uses MouseOnEvent UDF: ;~ #include <_debug.au3> #include <Misc.au3> #include <MouseOnEvent.au3> Global $isRightMouse = false Global $isRotateStarted = false Func debug($text) ConsoleWrite($text & @CRLF) EndFunc Func _secondaryDown() $isRightMouse = true EndFunc Func _secondaryUp() $isRightMouse = false if $isRotateStarted Then debug("rotate stopped") send("{CTRLUP}{ALTUP}") MouseUp("left") EndIf $isRotateStarted = false EndFunc Func _mouseMove() If Not $isRotateStarted And $isRightMouse Then $isRotateStarted = true Send("{CTRLDOWN}{ALTDOWN}") MouseDown("left") debug("rotate started") EndIf EndFunc _MouseSetOnEvent($MOUSE_MOVE_EVENT, "_mouseMove") _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT, "_secondaryDown") _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_secondaryUp") ; Idle While 1 if _IsPressed("1B") Then ExitLoop Sleep(10) Wend _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT) _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT) For the most part it works fine, except for one tiny issue: when I drag with right mouse button for the second time the cursor freezes and moves ones a second, I can't even kill the script via task manager (access denied WTF!) Requires reboot to revive the system. Any ideas what could be wring with the code and any other suggestions how to achieve this? Thank you! P.S. And to answer invadable questions "why do you need this?": OrcaSlicer as well as BambuStudio have the most idiotic controls: dragging with left click will rotate the world unless(!!!) cursor is pointing at an object. than it moves the object instead. While dragging with right or middle mouse buttons does exactly same thing: panning. Dragging with left mouse button while CTRL+ALT are held rotates the world regardless of what cursor is pointing at. So, simulating CTRL+ALT+LeftMouse drag via single RightMouse drag would free up my other hand for more important tasks and mostly would leave my sanity alone.
-
Get data from an object without knowing it's structure?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
How would eval reveal what's inside an object? A "simple" debug function that would output in console whatever was provided to it. So, I could simply add debug($myvar) anywhere in the code and don't worry about providing any additional information about what that $myvar is. -
Don't take focus when executed compiled CUI script?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
Strange. Your code works on my other computer, but not on this one: it focuses on some hidden "MSCTFIME UI" window. -
Don't take focus when executed compiled CUI script?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
@ioa747 does it work for you? (it doesn't for me) For example, when you double click on compiled .exe and without clicking anywhere press up/down cursor keys - does it change to next/previous file in the explorer window? If not = it doesn't work. -
Don't take focus when executed compiled CUI script?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
I'm not sure what other meaning of "focused" there could be, other than the window that is being interacted with, aka currently activated. Look at the screenshot of the task manager. See the 2 applications under 1.exe (2) - these are two separate processes launched when 1.exe is executed. On my system when a window is focused its title bar is blue, otherwise it's gray. On the screenshot it's blue = focused. So, with your code on my system the title bar of the console window remains blue, and not the explorer window I launched it from. @ioa747 Your code almost works for me, the console window loses focus, but no other window gets focused either (at least visibly), I have to add WinSetState($hNextWindow, "", @SW_SHOW) - then it worked but with 0.5sec delay: #AutoIt3Wrapper_Change2CUI=y #include <WinAPI.au3> Local $hWnd = WinWaitActive(@ScriptFullPath) ConsoleWrite("$hWnd=" & $hWnd & @CRLF) ; Get the handle of the next window in Z order Local $hNextWindow = _WinAPI_GetWindow($hWnd, $GW_HWNDNEXT) WinActivate($hNextWindow) WinSetState($hNextWindow, "", @SW_SHOW) Sleep(6000) -
Don't take focus when executed compiled CUI script?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
Hmm it doesn't for me on Win 10 x64 Console remains focused. This is because it's not the @AutoItExe window, but "Console Window Host" window, which is separate process: -
Don't take focus when executed compiled CUI script?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
That would do it, but I'm trying find a way to do it within same script if possible. For example, I probably could do something if I could figure out how to get hwnd of the console window. Also, launcher can just run the program with @SW_SHOWNOACTIVATE as one-liner: Run("myCUIapp.exe", @WorkingDir, @SW_SHOWNOACTIVATE, 0x10000) No need any WinActivate -
Don't take focus when executed compiled CUI script?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
Here is a somewhat working attempt relaunch itself as non-active window: #AutoIt3Wrapper_Change2CUI=y If $CmdLine[0] = 0 Then Run(@ScriptFullPath & ' 1', @WorkingDir, @SW_SHOWNOACTIVATE, 0x10000) Exit EndIf ConsoleWrite("Should start NOT focused") Sleep(60000) Unfortunately, it still steals focus for a moment -
Don't take focus when executed compiled CUI script?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
@ioa747 Thanks, it works, but very unreliable. Sometimes it switches to totally different application.. Sure #AutoIt3Wrapper_Change2CUI=y sleep(60000) Compile it and run from explorer. The opened console window will be in focus. The expected result: explorer window remains in focus, while console window remains visible on screen Note, as I mentioned before, this may be run by task scheduler, so any application can be in focus when it's launched. -
Don't take focus when executed compiled CUI script?
VAN0 replied to VAN0's topic in AutoIt General Help and Support
CUI is being launched either by the task scheduler (aka system) or by explorer (aka user) -
I'm trying make my compiled script as CUI to be shown on screen when ran (task scheduler or from explorer), but not taking focus. My initial idea was to relaunch itself with Run() and use @SW_SHOWNOACTIVATE flag, but it didn't work, it still showed focused console window. Any ideas how it can be achieved? Thank you.
-
VAN0 reacted to a post in a topic: Info about @exteneded codes when FileDelete fails?
-
pixelsearch reacted to a post in a topic: Info about @exteneded codes when FileDelete fails?
-
It seems sometimes during heavy system load WinSetTitle() might not set the title of a window. It acts like it was successful and WinGetTitle() returns correct title, but visible the title remains unchanged. Is there something can be done about this without putting WinSetTitle in a loop with a delay? P.S. I'm unable reproduce it at will by just running the script, even with 100% cpu usage with Prime95, it happens randomly and usually only during system startup.