Sign in to follow this  
Followers 0
DanielTyrkiel

Newbie is Learning 001: How to figure out attaching to embedded app in IE?

4 posts in this topic

Hi,

I have searched the wiki, read the help file, but can't understand it. What I'm trying to do is to open an existing excel file (done), copy cell value (done), go to embedded software (sort of done), search for that value(sort of done) and retrieve value from the first cell of the results table after sorting by receipt date.

When I use the window info tool, each time the session changes (as in next day) the handles or instance number changes. Also I don't know what I am attaching to when trying to use the _IEAttach() function. I don't know what I'm looking for in the spy window of debugbar.

See my code below and a couple of screenshots further down:

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.8.1
Author: Daniel Tyrkiel

Script Function:
read cell value in a specific Excell sheet
paste it into sys21 and find last supplier

#ce ----------------------------------------------------------------------------

; Script Start
#include
#include
Local $sFilePath = @MyDocumentsDir & "\ordering lists" & "\W053253 and 4.xlsx"
_ExcelBookOpen($sFilePath)
Local $oExcel = _ExcelBookAttach($sFilePath) ;with Default Settings ($s_mode = "FilePath" ==> Full path to the open workbook)
If $oExcel = 0 Then MsgBox(0, "", "failed to attach", 2)
;WinActivate("http://loma25.loma.co.uk - Live, UK - Loma UK, AUL Environment - Microsoft Internet Explorer")
For $i = 54 To 56 ;Loop
$sCellValue = _ExcelReadCell($oExcel, $i, 4)
Local $oLoma = WinActivate("http://loma25.loma.co.uk - Live, UK - Loma UK, AUL Environment - Microsoft Internet Explorer")
MouseClick("left", 200, 115, 2)
Send($sCellValue)
Send("{TAB}")
Send("{UP}")
Send("{DOWN}")
Send("{ENTER}")
Local $wPopUp = WinWaitActive("Host Message", "", 1)
If $wPopUp <> 0 Then
MouseClick("left", 644, 540)
_ExcelWriteCell($oExcel, "none", $i, 13)
ElseIf $wPopUp = 0 Then
MouseClick("left", 309, 226)
Send("{RIGHT}")
;Send("^C")
;MsgBox(0, "", ClipGet())
;Local $oEmbddCtrl = _IEAttach(0x002B0284, "embedded")
;If $oEmbddCtrl =
;MsgBox(0, "", "succesfully attached to control")
;_IEAttach([CLASS:SunAwtCanvas; INSTANCE:38])
;_IEAction($oLoma, "copy")
;_ExcelWriteCell($oExcel, ClipGet(), $i, 13)
EndIf
Next

Please see the images below

https://docs.google.com/open?id=0ByUpE9M4BFXIRGkzRDNkVkg4aG8

https://docs.google.com/open?id=0ByUpE9M4BFXIa2JQQlAwTE9LMTA

PS. Newbie is Learning 000 was my intro thread :)

Thank you

Daniel

Share this post


Link to post
Share on other sites



Right, I have stumbled upon the WinGetClassList function and ran it on my window.

Here's the result:

WorkerW
ReBarWindow32
ToolbarWindow32
AfxWnd90su
ComboBox
Edit
ComboBox
Edit
ComboBox
Edit
ToolbarWindow32
ComboBoxEx32
ToolbarWindow32
ComboBox
Edit
ToolbarWindow32
WorkerW
ToolbarWindow32
WorkerW
msctls_statusbar32
msctls_progress32
Shell DocObject View
Internet Explorer_Server
Internet Explorer_TridentCmboBx
Java Plug-in Control Window
sun.plugin.viewer.frame.IExplorerEmbeddedFrame
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Button
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Java Plug-in Control Window
sun.plugin.viewer.frame.IExplorerEmbeddedFrame
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Button
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Java Plug-in Control Window
sun.plugin.viewer.frame.IExplorerEmbeddedFrame
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Button
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Java Plug-in Control Window
sun.plugin.viewer.frame.IExplorerEmbeddedFrame
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Button
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Java Plug-in Control Window
sun.plugin.viewer.frame.IExplorerEmbeddedFrame
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Button
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Java Plug-in Control Window
sun.plugin.viewer.frame.IExplorerEmbeddedFrame
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Button
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Java Plug-in Control Window
sun.plugin.viewer.frame.IExplorerEmbeddedFrame
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Button
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Java Plug-in Control Window
sun.plugin.viewer.frame.IExplorerEmbeddedFrame
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Button
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
SunAwtCanvas
Internet Explorer_TridentCmboBx
Internet Explorer_TridentCmboBx

I still don't know what to do with it :D but at least I have identified all classes.

Feeling like a blind man with dark glasses in a forest at night...

cheers

Dan

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

And this is the code I used to obtain that info:

Local $text = WinGetClassList("[CLASS:IEFrame]", "")
;MsgBox(0, "Text read was:", $text)
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send($text)

Edit1:

I also found that the control instance number changes each time a particular tab is closed and reopened. Say at one time it will be [CLASS:SunAwtCanvas; INSTANCE:156], but next time it can be [CLASS:SunAwtCanvas; INSTANCE:27], or 36, or 5 etc. Does it mean that it gets assigned dynamically, and how do I check it on the fly to always get the right one?

Edit2: I have found an old thread here by googling SunAwtCanvas:

I'm not allowed to revive it as it is against forum rules, but I thought I'd mention that I had tried to use the Send("^c") function to copy but to no avail...

Edit3: in this thread I have found THE solution to sending Ctrl C and thus putting stuff into clipboard. YAY! I still want to learn how to properly attach to SunAwtCanvass, but I now can move on with my workflow.

Edited by DanielTyrkiel

Share this post


Link to post
Share on other sites

I've learned something today and therefore I feel obliged to share.

Finally I know now how to read the class instance from the creen I'm working with. It is by using ControlGetFocus() function.

Here's a code that does the check for me:

Local $window = WinActivate("http://loma25.loma.co.uk - Live, UK - Loma UK, AUL Environment - Microsoft Internet Explorer", "")
Local $sControl = ControlGetFocus ( $window , "" )
MsgBox(0, "ControlGetFocus Example", "The control that has focus is: " & $sControl)

another day, another line of code learnt... ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0