ryanbogadi Posted August 24, 2005 Share Posted August 24, 2005 I'm trying to write a program to automate a whole bunch of clicks and user inputs to a particular application and have run into a slight problem. Because of the nature of the application on top of which my script will be run, users will be required to calibrate the environment. So what I want is this: the user moves the cursor to a certian spot (button) in the application then presses a keyboard button (space bar). When the user hits the keyboard button, the script records the coordinates of the mouse. I know how to use MouseGetPos to get the coordinates, but I don't know how to have that done only when the user presses a key. Could someone please help me out? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 24, 2005 Developers Share Posted August 24, 2005 I'm trying to write a program to automate a whole bunch of clicks and user inputs to a particular application and have run into a slight problem. Because of the nature of the application on top of which my script will be run, users will be required to calibrate the environment. So what I want is this: the user moves the cursor to a certian spot (button) in the application then presses a keyboard button (space bar). When the user hits the keyboard button, the script records the coordinates of the mouse. I know how to use MouseGetPos to get the coordinates, but I don't know how to have that done only when the user presses a key. Could someone please help me out?<{POST_SNAPBACK}>HotKeySet() ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
w0uter Posted August 24, 2005 Share Posted August 24, 2005 _IsPressed() My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
seandisanti Posted August 24, 2005 Share Posted August 24, 2005 I'm trying to write a program to automate a whole bunch of clicks and user inputs to a particular application and have run into a slight problem. Because of the nature of the application on top of which my script will be run, users will be required to calibrate the environment. So what I want is this: the user moves the cursor to a certian spot (button) in the application then presses a keyboard button (space bar). When the user hits the keyboard button, the script records the coordinates of the mouse. I know how to use MouseGetPos to get the coordinates, but I don't know how to have that done only when the user presses a key. Could someone please help me out?<{POST_SNAPBACK}>you could go with either of the suggestions HotKeySet(), _IsPressed(), but i'm not sure that it's really necessary... are you doing the calibration for the sake of the code? i mean to like mathematically figure out the location of elements and controls? if so, you should definitely look at controlclick, controlsend, controlgetpos, and wingetpos in the helpfile. Link to comment Share on other sites More sharing options...
ryanbogadi Posted August 24, 2005 Author Share Posted August 24, 2005 Unfortunately the calibration is necessary because of the application that this will run on top of. Apparently the users can't agree on where to put certain windows and such, so they have to calibrate every time they start. I used HotKeySet and I now have it working perfectly. Strangely enough, since I started using AutoIT just yesterday, HotKeySet is pretty much the one thing I've used more than anything else. But for whatever reason I didn't even think to use it in this case. Thanks for your help. Ryan Link to comment Share on other sites More sharing options...
seandisanti Posted August 24, 2005 Share Posted August 24, 2005 Unfortunately the calibration is necessary because of the application that this will run on top of. Apparently the users can't agree on where to put certain windows and such, so they have to calibrate every time they start.I used HotKeySet and I now have it working perfectly. Strangely enough, since I started using AutoIT just yesterday, HotKeySet is pretty much the one thing I've used more than anything else. But for whatever reason I didn't even think to use it in this case. Thanks for your help.Ryan<{POST_SNAPBACK}>If the application uses default MS controls, rather than creating it's own, you can use controlclick/controlsend to send information to the controls they'd be clicking on or typing in, regardless of where on the desktop they have the window situated. thus eliminating the need for the calibration. Link to comment Share on other sites More sharing options...
ryanbogadi Posted August 25, 2005 Author Share Posted August 25, 2005 If the application uses default MS controls, rather than creating it's own, you can use controlclick/controlsend to send information to the controls they'd be clicking on or typing in, regardless of where on the desktop they have the window situated. thus eliminating the need for the calibration.<{POST_SNAPBACK}>So how do I find out if the application uses default MS controls? I mean, to me it looks pretty "default", just a bunch of intertwined tables and such. But I don't know anything about sending information to controls, aside from just clicking them then sending data. I would love to be able to do this without calibration if at all possible. Link to comment Share on other sites More sharing options...
seandisanti Posted August 25, 2005 Share Posted August 25, 2005 So how do I find out if the application uses default MS controls? I mean, to me it looks pretty "default", just a bunch of intertwined tables and such. But I don't know anything about sending information to controls, aside from just clicking them then sending data. I would love to be able to do this without calibration if at all possible.<{POST_SNAPBACK}>check out 'controlclick()' and 'controlsend()'. you may also want to look at 'controlsettext()'. actually, maybe just go to the index tab in your helpfile and type in 'control' and check out the things listed. good stuff. Link to comment Share on other sites More sharing options...
LxP Posted August 26, 2005 Share Posted August 26, 2005 And if that doesn't work for you: msgBox(0x30, "Calibration", "Move the mouse over the 'XY' control and then press Enter.") $coords = mouseGetPos() 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