Storm Posted February 2, 2009 Share Posted February 2, 2009 Hi,I just cant get controlclick to work.This is what I tried to do.;http://mamasgotmoxie.com/wp-content/uploads/2008/10/play-doh-magic-swirl-ice-cream-shoppe.jpeg controlclick("http://mamasgotmoxie.com/wp-content/uploads/2008/10/play-doh-magic-swirl-ice-cream-shoppe.jpeg - Windows Internet Explorer", "","" , "left", 1, 751, 453)I was just doing this to see if this command works, csince I wasent having any luck with getting oit to work with a game. I thought I would try on a simple internet explorer.Just go to http://mamasgotmoxie.com/wp-content/upload...eam-shoppe.jpeg and the image will streatch bigger than your monitor, soo just clik on it once to zoom in, and nother click should zoom out, so if the command worked the picture would zoom back in, but I get ablsolutly nothing from it.I am sure, it is a simple mistake on my part. Link to comment Share on other sites More sharing options...
KaFu Posted February 2, 2009 Share Posted February 2, 2009 You didn't identifiy the control to click. x&y is "[optional] The x position to click within the control. Default is center." ControlClick("http://mamasgotmoxie.com/wp-content/uploads/2008/10/play-doh-magic-swirl-ice-cream-shoppe.jpeg", "", "[CLASSNN:ToolbarWindow325]","left") OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Storm Posted February 4, 2009 Author Share Posted February 4, 2009 (edited) Hi, All right, now my script reads like this. expandcollapse popup#include <WinAPI.au3> HotKeySet("{ScrollLock}", "Tabs") Opt('MustDeclareVars', 1) GLobal $hWnd, $hWndTAB, $pos, $posTAB, $position, $control, $controlTAB While 1 Sleep(5000) WEnd Func Tabs() HotKeySet("{ScrollLock}") HotKeySet("{ScrollLock}", "Main") $hWndTAB = WinGetHandle("") $controlTAB = ControlGetFocus($hWnd) $controlTAB = ("[CLASSNN:"& $controlTAB &"]") $posTAB = MouseGetPos() While 1 Sleep(5000) WEnd EndFunc Func Main() HotKeySet("{ScrollLock}") $hWnd = WinGetHandle("") $control = ControlGetFocus($hWnd) $control = ("[CLASSNN:"& $control &"]") $pos = MouseGetPos() $position = ($pos[1] + 265) Click() EndFunc Func Click() HotKeySet("{ScrollLock}") while 1 ControlClick($hWnd, "", $control,"middle",1,$pos[0],$pos[1]) ControlClick($hWnd, "", $control,"middle",1,$pos[0],$position) sleep (1000) ControlClick($hWndTAB, "", $controlTAB,"middle",1,$posTAB[0],$posTAB[1]) sleep (1000) ControlClick($hWndTAB, "", $controlTAB,"middle",1,$posTAB[0],$posTAB[1]) Sleep(5000) WEnd exit EndFunc This script is meant to middle click a link on a page to open it in a new tab, then middle click another link to open in new tab as well. After this it will then close the 2 new tabs. And then after a specified time do the same thing over again. I didnt want to be restricted by entering the details like title, classnn, mouse position, etc, so I can use it on any computer with any resoloution, on any browser. So Basically now all I have to do is move my mouse over to where the next tab will open and press SCROLLLOCK once. It will take note of the classnn, window handle and the mouse cordinates, so it knows where to middle click to close the new tab. After that I just move my mouse to the first link and press SCROLLLOCK again. This time it will take the details for where to middle click to open new tabs. Now the second link sahres the X cordinate with the first link, and the Y cordinate will be exactly 265 pixels below the first one, so i just use the mouse position from the first link, to get the position of the second link too. After this the hotkey SCROLLLOCK is disabled so it wont interfare with the script and if free to be used by other programs. However now my problem is, that this command is getting the mouse cordinates regardless ofthe control. I need the cordinates for the mouse within that particular control. How do I do this? Is there a command for this or maybe some user script. Edited February 4, 2009 by Storm Link to comment Share on other sites More sharing options...
Storm Posted February 6, 2009 Author Share Posted February 6, 2009 Anyone? All I am asking is for a command that gives me current mouse coordinates regarding to the control. If such a command doesn't exist let me know please. Link to comment Share on other sites More sharing options...
KaFu Posted February 6, 2009 Share Posted February 6, 2009 What you could do is... get the Position of the Window with WinGetPos() get the relative position of the control with ControlGetPos() and calculate the absolute difference to MouseGetPos(). To be honest I've started this way too, trying to identify controls, move the mouse and emulate clicks. Only to switch to the (little more complicated but) more reliable use of either the UDF <IE.au3> (standard UDF) of <FF.au3> (search the examples) to access the info directly. This way you're not dependent that nobody touches the mouse or keyboard or that you're script is busted because the user has a different screen resolution then you have ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
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