Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Mouse Position Alternative?


  • Please log in to reply
13 replies to this topic
brettahk
  • Members
  • 19 posts
  • Last active: Dec 28 2007 10:31 PM
  • Joined: 05 Dec 2007
Right now I have a script which will copy numbers and then paste them into the correct field in another window and does a few other things. Largely the script is dependent on different mouse click positions.

My question: Is there an alternative way of finding fields without using a mouse position? I need to use this on a few different computers and they are all set up a little bit different and positions are in different spots.

Every time i use the script on a different computer, the fields will be in a different place and the script will not work correctly.

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
it depends on your target program.
Web browsers -> javascript
skinned, Flash or Java programs -> hard
others -> ControlSend, ControlClick, Control, etc.

brettahk
  • Members
  • 19 posts
  • Last active: Dec 28 2007 10:31 PM
  • Joined: 05 Dec 2007
Thanks for the help. I found out the ClassNN field is Edit1.

How do i tell the script to go to that location?

This would help me out sooo much, thanks for any help

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
move the mouse there or just put text there

ControlFocus and Control will help you there.

brettahk
  • Members
  • 19 posts
  • Last active: Dec 28 2007 10:31 PM
  • Joined: 05 Dec 2007
alright it works but there are multiple fields with that label.

I found out I could also have it search for text and if I click on the "Request #" Text it will go to the field that I want.

Therefore I need to find out how to click where the text Request # is.

Is this possible?

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
you could WinGet ControlList and then loop through the results, though the label and the edit field are different fields.

There should not be more than one Edit1

brettahk
  • Members
  • 19 posts
  • Last active: Dec 28 2007 10:31 PM
  • Joined: 05 Dec 2007
well the problem is that the program has 4 windows on the main page. In each window are multiple fields of data and window spy is showing the same "Edit1" Label in each window. But I was thinking maybe i could tell the script to click in the correct window and then click in the Edit1 field. If I have problems I will let you know.

Thanks for all the quick help engunneer.

brettahk
  • Members
  • 19 posts
  • Last active: Dec 28 2007 10:31 PM
  • Joined: 05 Dec 2007
alright well I was able to find out pretty quickly it did not work.

heres the code

^1:: 
WinActivate, CMRS - All Service Requests
IfWinActive, CMRS - All Service Requests
ControlClick, Button10, CMRS - All Service Requests,
Sleep, 100
ControlClick, Edit1, CMRS - All Service Requests,
Return

Button10 is the window field and Edit1 is the field i want to insert numbers into.

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
can you post a screenshot of the app? is it an MDI (Multiple document interface) or some funky tabbed program?

brettahk
  • Members
  • 19 posts
  • Last active: Dec 28 2007 10:31 PM
  • Joined: 05 Dec 2007
Alright heres a screenshot.

As you can see there is actually 5 windows, and there are multiple Edit1 labels and then I thought I could get around it by telling it to first click the Request Information button and then the Edit1 label which is the Request # field.

Now that you can see the program all I want is to hit Ctrl+1 and then go to this program and click at the Request Number field. Using a mouse position works but only on my computer. I use several different computers and the time this would save would be immense as I also have scripts set up for other menu's.

Thanks for the help

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
you'll have to host the picture somewhere other than your gmail. try autohotkey.net

brettahk
  • Members
  • 19 posts
  • Last active: Dec 28 2007 10:31 PM
  • Joined: 05 Dec 2007
sorry about that heres the screenshot:
Posted Image

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
it's odd for each one to have an Edit1 with a layout like that. It hink you can do it, but it will relly just be a bunch of mucking about with commands taht start with Control.

does each sub window show up with a different wintitle in the window spy?

brettahk
  • Members
  • 19 posts
  • Last active: Dec 28 2007 10:31 PM
  • Joined: 05 Dec 2007
Ya if I click on Request Information window spy shows ClassNN as Button10 but if I click on Requestor Information then it shows up as Button 14. If I click on response information and hover over the button it shows up as button 26. So I have no clue what to do.