Jump to content

Is it possible to move to mouse to tabbed field?


 Share

Recommended Posts

I am working with a long form and am creating a simple script that will use the mouse to copy & select a value to the clipboard from a field.  The problem is, the mouse position of the field changes depending on what item is being viewed.  However, the tabbed position is always the same.  After the form is loaded, I always hit the TAB button 9 times and I am at the field I need.  

I want my script to hit the tab button 9 times, then move my mouse to the tabbed position.  Window Info tool does not give me any information to really work with.  I just need help to move my mouse to the tabbed field.  Is this possible?

Link to comment
Share on other sites

What kind of window, what kind of control.

Post the "window info" summary tab.

 

Here is the Window Info Summary tab

>>>> Window <<<<
Title:  Orders Toolkit
Class:  WindowsForms10.Window.8.app5
Position:   -8, -8
Size:   1456, 876
Style:  0x17CF0000
ExStyle:    0x00050100
Handle: 0x000112C0

>>>> Control <<<<
Class:  Internet Explorer_Server
Instance:   2
ClassnameNN:    Internet Explorer_Server2
Name:   
Advanced (Class):   [CLASS:Internet Explorer_Server; INSTANCE:2]
ID: 
Text:   
Position:   4, 24
Size:   1446, 792
ControlClick Coords:    587, 488
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x000112D0

>>>> Mouse <<<<
Position:   591, 554
Cursor ID:  2
Color:  0xEEEEEE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Toolkit


>>>> Hidden Text <<<<

I cannot type text in the field but I can highlight and select its contents, which is what I need.

Edited by blehbloo
Link to comment
Share on other sites

I think I might have found a simple workaround.  Working from the top of the page down, the mouse position of the needed field is typically varied.  Starting at the bottom of the page and working up, the text field is always in the same position.  So I'll attack it that way.  Thanks for the help.

Link to comment
Share on other sites

 

Use:

_IEGetObjById
_IEFormElementGetValue
_IEFormElementSetValue

 

I thought I had a workaround but its not working 100% of the time.  So I want to use your more accurate suggestion.  If I view the source of the window, here is what I get:

<a href="javascript://" onClick="doTable('outline-item-list', 'baseEditor.jsp', 'outline-editor', 'list-item_2652');" title="  { Max Legal Size = -1 }"> Outline Members</a>
      </td>
      
      <td width="60%">
        
        <table 
          class="detailSmallEditTable" 
          align="left" 
          cellspacing="0" 
          border="1">
          
              
              <tr>
                <td><div class="divHScroll">ED morphine inj</div></td>
              </tr>
              
              
            </table>
          </td>
          <td> </td>
        </tr> 

The field I need will always be "Outline Members".  The contents inside will vary. In this instance, what I would want to copy to the clipboard is "ED Morphine inj".

Edited by blehbloo
Link to comment
Share on other sites

You can use my signature, where your xpath would be: "//div[@class='divHScroll']"

Or, you can grab all the 'div' elements (there is an _IE function do to so), and then loop through all of them until your $o.classname = 'divHScroll'.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

You can use my signature, where your xpath would be: "//div[@class='divHScroll']"

Or, you can grab all the 'div' elements (there is an _IE function do to so), and then loop through all of them until your $o.classname = 'divHScroll'.

 

I appreciate all the help.  I am trying to grab the information using the methods you describe but I am having an issue grabbing the right browser window.  Rather than start another thread, I figured I'd ask here.

This is an application where it appears the information being displayed is written in HTML/JS and displaying in a window.  My current code below will attach to a browser window and spit out HTML but it is not grabbing the right window/pane.  I've tried changing the instance number but I still can't grab the proper window.  I've also attached the Window Info summary.    Any ideas on how to tackle the problem of grabbing the correct window/instance?

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $hWnd = WinWait("[CLASS:WindowsForms10.Window.8.app5]", "", 10)
Local $oIE = _IEAttach($hWnd, "embedded", 2)
Local $sHTML = _IEDocReadHTML($oIE)
MsgBox($MB_SYSTEMMODAL, "Document Source", $sHTML)
>>>> Window <<<<
Title:  Orders Toolkit
Class:  WindowsForms10.Window.8.app5
Position:   -8, -8
Size:   1456, 876
Style:  0x17CF0000
ExStyle:    0x00050100
Handle: 0x00CE0B40

>>>> Control <<<<
Class:  Internet Explorer_Server
Instance:   2
ClassnameNN:    Internet Explorer_Server2
Name:   
Advanced (Class):   [CLASS:Internet Explorer_Server; INSTANCE:2]
ID: 
Text:   
Position:   4, 24
Size:   1446, 792
ControlClick Coords:    1346, 347
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x000D0B26

>>>> Mouse <<<<
Position:   1350, 413
Cursor ID:  2
Color:  0xEEEEEE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Toolkit


>>>> Hidden Text <<<<
Edited by blehbloo
Link to comment
Share on other sites

Not following.  Are you having issues finding the correct window, or the correct embedded browser IN your window.

If you use the wrong window, you won't attach to your intended browser.  The window functions accept instance as well (check the helpfile).

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Not following.  Are you having issues finding the correct window, or the correct embedded browser IN your window.

 

Sorry, the terminology is a little confusing to me.  I'm 99% sure I'm grabbing the correct window.  I believe my issue is grabbing the correct embedded browser in the window.

Link to comment
Share on other sites

Just to be sure, run this:

$a = WinList("[CLASS:WindowsForms10.Window.8.app5]")
ConsoleWrite(UBound($a) & @CRLF)

Your _ieattach looks fine, so I'm suspect of the window.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

That means you have (edit) 2 windows matching...you might not be grabbing the window you expect to.

Look into the helpfile (Title special definition link):

WinGetHandle
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

 

That means you have (edit) 2 windows matching...you might not be grabbing the window you expect to.

Look into the helpfile (Title special definition link):

WinGetHandle

 

Still no luck.  I am grabbing a browser from that window but it is not the correct one.  Is there a way to display how many embedded browsers there are?

At this point, I'm wondering if I should just script "right click ->view source" and read it that way.

Link to comment
Share on other sites

 

That means you have (edit) 2 windows matching...you might not be grabbing the window you expect to.

Look into the helpfile (Title special definition link):

WinGetHandle

 

Here is what the WinGetHandle gives me:

Row                        Col 0           Col 1
[0]                             1                        
[1]                     Orders Toolkit       0x00CE0B40
 
 
How would I see how many instances or embedded browsers are part of "Orders Toolkit"?
Edited by blehbloo
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...