Mesca Posted November 2, 2009 Share Posted November 2, 2009 I have made a really small script the utilizes mouse clicks from x,y co-ordinates. If I wanted to share this script, how can make it work on other PC's, since there are variables like different screen resolutions, etc.? Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 2, 2009 Share Posted November 2, 2009 You can get desktop size from the macros (@DesktopHeight, @DesktopWidth). If the coordinates are relative to a window, then you probably don't need to worry about it. Just set Opt("MouseCoordMode", 0) (or mode = 2). 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 Link to comment Share on other sites More sharing options...
Valuater Posted November 2, 2009 Share Posted November 2, 2009 Give this a try... ; Settings for the mouse ; This is for the 1440 x 900 screen - change as needed Global $Width = 1440 Global $Height = 900 MyMouseMove(100, 200) Func MyMouseMove($x, $y) MouseMove(@DesktopWidth * $x / $Width, @DesktopHeight * $y / $Height) EndFunc ;==>MyMouseMove 8) Link to comment Share on other sites More sharing options...
Mesca Posted November 2, 2009 Author Share Posted November 2, 2009 You can get desktop size from the macros (@DesktopHeight, @DesktopWidth).If the coordinates are relative to a window, then you probably don't need to worry about it. Just set Opt("MouseCoordMode", 0) (or mode = 2). I understand what you mean, but the script I made if a website. So just say the other user has different settings in Internet Explorer like no status bar or buttons at the top, the co-ordinated would change Link to comment Share on other sites More sharing options...
evilertoaster Posted November 2, 2009 Share Posted November 2, 2009 I understand what you mean, but the script I made if a website. So just say the other user has different settings in Internet Explorer like no status bar or buttons at the top, the co-ordinated would changeIf you're trying to simulate input to a webpage, you could try using 'IE Management' UDF for more reliable functions then clicking screen locations. Link to comment Share on other sites More sharing options...
Bert Posted November 2, 2009 Share Posted November 2, 2009 What is the website? That would help a bunch in figuring it out. The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 3, 2009 Share Posted November 3, 2009 I understand what you mean, but the script I made if a website. So just say the other user has different settings in Internet Explorer like no status bar or buttons at the top, the co-ordinated would changeUse the IE.au3 UDF. Get an object reference to the element (i.e. $oElement) you are interested in and get the position with _IEPropertyGet($oElement, "browserX") with browserX\browserY, or screenX\screenY. Of course, if all you want to do is click that element, you can just do _IEAction($oElement, "click") without looking for coordinates at all.Spend some time with the example scripts in the help file for the _IE* functions. 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 Link to comment Share on other sites More sharing options...
Mesca Posted November 3, 2009 Author Share Posted November 3, 2009 Use the IE.au3 UDF. Get an object reference to the element (i.e. $oElement) you are interested in and get the position with _IEPropertyGet($oElement, "browserX") with browserX\browserY, or screenX\screenY. Of course, if all you want to do is click that element, you can just do _IEAction($oElement, "click") without looking for coordinates at all.Spend some time with the example scripts in the help file for the _IE* functions. I used a javescript to find the x,y position of the element I am trying to click. How do I phrase my _IEAction line so it will click it?Thank you for your help and patience. Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 3, 2009 Share Posted November 3, 2009 I used a javescript to find the x,y position of the element I am trying to click. How do I phrase my _IEAction line so it will click it?Thank you for your help and patience.You don't with the coordinates. _IEAction() requires an object reference to the DOM element you want to act on. 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 Link to comment Share on other sites More sharing options...
Mesca Posted November 3, 2009 Author Share Posted November 3, 2009 You don't with the coordinates. _IEAction() requires an object reference to the DOM element you want to act on. Sorry for being a complete noob, but do you find the name of the object reference? Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 3, 2009 Share Posted November 3, 2009 Sorry for being a complete noob, but do you find the name of the object reference?Let's back up to some basics that were passed over earlier: 1. Is this a point on a web page you want to click on?2. If so, what kind of web page is it, and what is the nature of the element you want to click on (i.e. submit button, link, etc.)? 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 Link to comment Share on other sites More sharing options...
Mesca Posted November 3, 2009 Author Share Posted November 3, 2009 Let's back up to some basics that were passed over earlier: 1. Is this a point on a web page you want to click on?2. If so, what kind of web page is it, and what is the nature of the element you want to click on (i.e. submit button, link, etc.)? Yes, I want to click a certain point on the page. It is a forum, and I want to to select the first topic within the forum.So the first topic can always change and is not a set button.I made the bot already using MouseClick and it works fine for me, but I was wondering about sharing it. Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 3, 2009 Share Posted November 3, 2009 Yes, I want to click a certain point on the page. It is a forum, and I want to to select the first topic within the forum.So the first topic can always change and is not a set button.I made the bot already using MouseClick and it works fine for me, but I was wondering about sharing it.If it works, go with it. If you want something more reliable, you could look at the page with a DOM inspector like DebugBar. You'll probably find the links to the topics within a FORM element, and for example, you could just click on the first link element in that form. This all depends on learning something about HTML and the DOM as used by the IE.au3 UDF in AutoIt. Maybe it's not worth the effort right now if you've got an easy work-around. But if you keep writing scripts towards web pages, you will eventually want to learn it. 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 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