indigoblue Posted April 30, 2007 Posted April 30, 2007 Can someone tell me how i move the mouse in a given window (ideally using the hwnd of the window.) I can't find a way to do this, I need to to do this because the window my macro is running in doesn't always have focus. Thanks.
Zedna Posted April 30, 2007 Posted April 30, 2007 Look at MouseMove ( x, y [, speed] ) function and Opt('MouseCoordMode') and WinGetPos()If your window is active then use Opt('MouseCoordMode') = 0 --> relative coords to the active windowYou may get pos oof your window and use MouseMove with position of window + relative position Resources UDF ResourcesEx UDF AutoIt Forum Search
indigoblue Posted April 30, 2007 Author Posted April 30, 2007 (edited) Look at MouseMove ( x, y [, speed] ) function and Opt('MouseCoordMode') and WinGetPos() If your window is active then use Opt('MouseCoordMode') = 0 --> relative coords to the active window You may get pos oof your window and use MouseMove with position of window + relative position Unless i've misunderstood it that function is no good to me because it does not allow me to specify which window I want to send mouse movement to. I have tried using mousemove but when i click off the window and it looses focus the mouse movements are disrupted. Please advise. TIA. Edited April 30, 2007 by indigoblue
xcal Posted April 30, 2007 Posted April 30, 2007 (edited) Your description isn't that great. Try one of the Control* functions. Edited April 30, 2007 by xcal How To Ask Questions The Smart Way
indigoblue Posted April 30, 2007 Author Posted April 30, 2007 Sorry. I'll try to explain fuller - please accept apologies if i have been too vague. I run five instances of the same program. The programs run on the desktop and are arranged so i can see them all at the same time, but obviously only one of them can have focus. I have a seperate macro for each of the five instances which i need to run at the same time. So the problem isn't that I don't know how to make a window have focus. It is that at any one time there will be at least four windows that don't have focus that I want a macro to be running in. I hope that has made it clearer. TIA for any further advice.
Shevilie Posted April 30, 2007 Posted April 30, 2007 Well your mouse cant be in 5 places at the same time.... Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
PsaltyDS Posted April 30, 2007 Posted April 30, 2007 You need a single script to act as a dispatcher, timesharing between the instances of the application. A faint hope for what you are trying to do might be something like _MouseMovePlus(). I've never used it, but I believe it was described as being able to do mouse movement and clicks inside minimized windows. So maybe that would work... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
herewasplato Posted April 30, 2007 Posted April 30, 2007 Yes, you need to only be running one script, but are you sure that you must use the mouse? Take a look at the Control functions like xcal mentioned. If you must use the mouse, then consider changing the title of each window as they startup so that you can control them individually.WinSetTitle () [size="1"][font="Arial"].[u].[/u][/font][/size]
loraevil86 Posted May 2, 2020 Posted May 2, 2020 ;~ shizuku (43.48%) ;~ ahk_class ApolloRuntimeContentWindow ;~ ahk_exe Live2D Viewer.exe ;~ ahk_pid 29676 SetTitleMatchMode RegEx CoordMode, Mouse, Screen beginning: loop{ MouseGetPos, xx, yy ControlClick,X%xx% Y%yy%, shizuku\.modell \(\d+.*,,LEFT,1,D sleep 200 } End:: exitapp return can help me run ths script ths doesnt seem to work the is not tracking the mouse
Moderators Melba23 Posted May 2, 2020 Moderators Posted May 2, 2020 loraevil86, This is the AutoIt forum - I suggest you post on the AHK forum for help with that script. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts