Rex Mundi Posted June 5, 2006 Posted June 5, 2006 Hi, Can someone please explain how I can tell E.g. the "MouseClick", or "MouseMove" commands to use the x, y position for "In Window", and not "On Desktop", when I use the "Autoit v3 Active Window Info"? It would be a great help if I knew how to navigate around inside a specific open window..
Emperor Posted June 5, 2006 Posted June 5, 2006 Take a look at 'MouseCoordMode' under the AutoItSetOption function in the help file.
Rex Mundi Posted June 5, 2006 Author Posted June 5, 2006 Thanks a lot Emperor, that was just the hint I needed.. I ended up using this combination: Opt("MouseCoordMode", 0) MouseClick("left", 400, 380) But tell me, will I have to use this: Opt("MouseCoordMode", 0) MouseClick("left", 400, 380) Opt("MouseCoordMode", 1) If I want the rest of my "MouseClick" in the script, to move allover the desktop? Or in other words, will the Opt("MouseCoordMode", 0) effect the rest of the script if I don't make a counter command?
herewasplato Posted June 5, 2006 Posted June 5, 2006 (edited) Rex Mundi said: ...But tell me, will I have to use this: Opt("MouseCoordMode", 0) MouseClick("left", 400, 380) Opt("MouseCoordMode", 1) If I want the rest of my "MouseClick" in the script, to move allover the desktop? Or in other words, will the Opt("MouseCoordMode", 0) effect the rest of the script if I don't make a counter command?Yes... ...but I would suggest that you look into ControlClick and ControlCommand. Avoid MouseClicks when possible. Edited June 5, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
Rex Mundi Posted June 5, 2006 Author Posted June 5, 2006 herewasplato said: Yes......but I would suggest that you look into ControlClick and ControlCommand.Avoid MouseClicks when possible.Ok thanks, I'll try to look at ControlClick and ControlCommand. But why is MouseClick some think I should avoid?
Xenobiologist Posted June 5, 2006 Posted June 5, 2006 Rex Mundi said: Ok thanks, I'll try to look at ControlClick and ControlCommand. But why is MouseClick some think I should avoid?Hi,I think the advantage is, you do not have to care about the position of the control, the funcs work even if the window(which includes the control) isn't active.So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
JoshDB Posted June 5, 2006 Posted June 5, 2006 This might be a longer way of doing things, but I did this: $MCoords = MouseGetPos() $WCoords = WinGetPos("SLB2") $MCoords[0] = $MCoords[0] - $WCoords[0] $MCoords[1] = $MCoords[1] - $WCoords[1] To make $MCoords correspond to the window. Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
herewasplato Posted June 5, 2006 Posted June 5, 2006 (edited) Rex Mundi said: ...But why is MouseClick some think I should avoid?If you use controls - a human is less likely to mess things up by moving the mouse while the script is running. There is a function to block that, but why bother. ...and to restate what th.meger mentioned: If you ever use your script on more than one computer, you may find that different screen resolutions cause buttons within an application to be at different coordinates. and The window being controlled does not have to be in focus. Try each of these 3 demo scripts - manually closing Notepad between each: Run("notepad", "", @SW_SHOW) WinWait("Untitled - Notepad") ControlSend("Untitled - Notepad", "", "Edit1", "Sending text.")oÝ÷ Ølzwlr«iË^®Ëh¶§¢×©iÜ"Ú0¢wµ«bæ§vØb±Êy«¢+ÙIÕ¸ ÅÕ½Ðí¹½ÑÁÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°M]}M!=¤)]¥¹]¥Ð ÅÕ½ÐíU¹Ñ¥Ñ±´9½ÑÁÅÕ½Ðì¤) ½¹Ñɽ±MÑQáÐ ÅÕ½ÐíU¹Ñ¥Ñ±´9½ÑÁÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí¥ÐÄÅÕ½Ðì°ÅÕ½ÐíM¹¥¹ÑáиÅÕ½ÐìoÝ÷ ÚDzØ^µìmjYZ¶Üy©Ý~)Ú¢l©¢)íjëh×6Run("notepad", "", @SW_MINIMIZE) WinWait("Untitled - Notepad") ControlSetText("Untitled - Notepad", "", "Edit1", "Sending text.")Not only does the window not have to be in focus, it can be minimized - allowing you to use your computer for other things while a script is running. Caveat: not all things can be done to all windows/controls using the AutoIt's control functions. ...enjoy... Edited June 7, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
Rex Mundi Posted June 6, 2006 Author Posted June 6, 2006 Ok, thanks all, and thanks herewasplato for your detailed explanation. I'm pretty new to this as you can see, so it will probably take me some time to figure out the smartest way to do these scripts. Bout at least I have something to start on now.
Rex Mundi Posted June 9, 2006 Author Posted June 9, 2006 Ok. I have looked at this for quite a while now, but I really can't figure out how to make this command: Opt("MouseCoordMode", 0) MouseClick("left", 400, 380) With the use of ControlClick and ControlCommand, instead of MouseClick? It seems like the button I want to click within the window, only respond to a mouse click, as far as I can see, it looks like it can't be activated by any keystroke!! So.. I really need a little help here! Could some of you guys please post some examples that show me how to press this button using ControlClick or ControlCommand, instead of using MouseClicks? Thanks in advanced.
Moderators SmOke_N Posted June 9, 2006 Moderators Posted June 9, 2006 (edited) Rex Mundi said: Ok. I have looked at this for quite a while now, but I really can't figure out how to make this command: Opt("MouseCoordMode", 0) MouseClick("left", 400, 380) With the use of ControlClick and ControlCommand, instead of MouseClick? It seems like the button I want to click within the window, only respond to a mouse click, as far as I can see, it looks like it can't be activated by any keystroke!! So.. I really need a little help here! Could some of you guys please post some examples that show me how to press this button using ControlClick or ControlCommand, instead of using MouseClicks? Thanks in advanced.Open up your AutoInfo Tool, move your mouse over the "active" window that has the button, move the mouse now over the button, press Ctrl+Alt+F to pause the AutoInfo window. Now, you have information there. AutoInfo Tool said: >>>>>>>>>>>> Window Details <<<<<<<<<<<<< Title: C:\Documents and Settings\SmOke_N\Au3_Files\Some.au3 * SciTE [10 of 10] Class: SciTEWindow >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: X: 2 Y: 50 W: 1276 H: 739 Control ID: 350 ClassNameNN: Scintilla1 Text: Source Now you can play with your ControlClick.ControlClick("C:\Documents and Settings\SmOke_N\Au3_Files\Some.au3 * SciTE [10 of 10]", 'Source', 'Scintilla1') Edited June 9, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
PsaltyDS Posted May 3, 2008 Posted May 3, 2008 (edited) Rex Mundi said: If I want the rest of my "MouseClick" in the script, to move allover the desktop? Or in other words, will the Opt("MouseCoordMode", 0) effect the rest of the script if I don't make a counter command?When you use Opt() to set an option it returns the previous value, which gives you a chance to save it for restore later on: $MouseCoordModeSave = Opt("MouseCoordMode", 0) ; Change mode to "active window", saving old mode ; Do stuff Opt("MouseCoordMode", $MouseCoordModeSave) ; Restore the old mode Edited May 3, 2008 by PsaltyDS 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now