Jump to content
Fractured

Question on adding functionality to an application

Recommended Posts

Fractured

Ok, so we use Macola here at work..There is a page that opens when you enter a models  part number that lists all parts used to build said model. That page does not have a search function..yet that page can list hundreds of parts. Theoretically, can you give that page a "search" function using a script...i.e. "read" the page and do a search function without actually loading the page..maybe like an OCR on screen.....or would that be a painful affair?

here is the summary from the Autoit Window Info

 

macola window info.png

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@Fractured
Have you already tried with Win* functions and/or Control* functions to see if you can automate it in some way? :)

  • Like 1

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Fractured

Not even sure what that is but now I have a track to read upon and learn! Thanks!

Share this post


Link to post
Share on other sites
Fractured

Ok so doing some quick reading it appears the window that macola opens with the parts is a tree view.

So in theory I should be able to check if window is open and active(WinActive), expand all branches(TreeView_Expand), set a search string(TreeView_GetISearchString), select an item(TreeView_Select),  and retrieve is info(TreeView_GetSelection)...

1) Wrote a quick GetInfo script and it sees the Window and Retrieves its PID. SUCCESS!!!

Next ill see if the script can expand all items!!

 

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro
Posted (edited)

@Fractured

Since you are going forward with you script, let me give you a little hint... There are several functions to deal with Treeview controls:

_GUICtrlTreeView_* functions and ControlTreeView() :)

Edited by FrancescoDiMuro
  • Thanks 1

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Fractured

Quick questions:

1)Does the GuiCtrlTreeView only control a GUI I create? - The help reads that way, but ive never used treeview....ever!!!

2) It appears that it always calls out AfxOleControl42...is that just a pointer? Not the actual control in the Macola window?

Would Simple Spy be a beter choice to get info from the Macola Window?

Share this post


Link to post
Share on other sites
Fractured

The only problem im having is that I cant read any control ID's beyond  the main window Even simple spy only shows its an Afx type control...hmmmmmmm...reading about Afx....stupid Macola!! But i did find the DLL's associated with what im trying to do...but I cant explore them at work...Firewall/Antivirus kills dll explorers...Corp controled so I cant change anything here!

Share this post


Link to post
Share on other sites
FrancescoDiMuro
Posted (edited)

@Fractured

About your questions...

1) ControlTreeView() controls any Treeview of almost any GUI, even if it's not created by you;

2) AfxOleControl is the class name of the control. If you try to get information about the Toolbar in Notepad++, you'll see that it changes; but, when you have the handle of that control, you can do almost everthing with it.

I can't ask you to make a reproducer script, so, I can only say what you could try :)

EDIT:

Reading you last post, seems that there is a Dll that it's used to read data from AfxOleControl, is it right? :)

Edited by FrancescoDiMuro
  • Thanks 1

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Fractured

I can get the ControlClick Coords, but no handle wither through simple spy, Autoit Windows Info, nor the _ControlGetHandleByPos UDF...always comes up 0..

will attack this again tomorrow! Thanks for all the help today!

Share this post


Link to post
Share on other sites
FrancescoDiMuro
Posted (edited)

@Fractured

Another little suggestion: WM_GETTEXT.

Post the script then ( if you want ), so we can see how we can help you :)

Edited by FrancescoDiMuro
  • Thanks 1

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Fractured

Good Morning Autoit folks!! Ok..so after a night of playing with the kids, working in the wood shop, and tequila.....I now am not sure if the Macola page is a TreeView or ListView...but I did try @Zedna little hint and it does give me back what appears to be a valid HWND...so now im on to @FrancescoDiMuro suggestion!! 

The code is really just a morphing proof of concept to see if I can interact with the Macola page but ill post what little I have....its just in the info gathering stage and silly testing stage!

; Notes:    Object Versions
;           1.  IMViewES.dll        IM View Object      9.5.26
;           2.  PPMasterES.dll      POP Master Object   2.0.12
;           3.  MacBompES.dll       BOM Object          9.6.104

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <MsgBoxConstants.au3>
#include <Process.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>

$iPID = 0

_GetInfo()

Func _GetInfo()
    $hWnd = WinWait("Bill Of Resource - (View only)")
    $iPID = WinGetProcess($hWnd)
    $WGCL_Macola = WinGetCLassList($hWnd)
    $WGH_Macola = WinGetHandle($hWnd)
    $CGH_hwnd = ControlGetHandle('Bill Of Resource - (View only)','','AfxOleControl423')
    If IsHWnd($CGH_hwnd) Then
         MsgBox($MB_SYSTEMMODAL, "", "It's a valid HWND")
    Else
        MsgBox($MB_SYSTEMMODAL, "", "It's not a valid HWND")
    EndIf
    MsgBox($MB_SYSTEMMODAL, "", "The PID is: "& $iPID)
    MsgBox($MB_SYSTEMMODAL, "", "The Class List is: "& $WGCL_Macola)
    MsgBox($MB_SYSTEMMODAL, "", "The Win Get Handle is: "& $WGH_Macola)
    MsgBox($MB_SYSTEMMODAL, "", "The Handle is: "& $CGH_hwnd)
EndFunc

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@Fractured
Nice to know that everything is going well :)
So, now you only have to see which functions fits your "request".

Let us know!


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Fractured

So if I use the info tool and click where there is text on the page and see that is shows no visable text..and the hidden text says "View - Default Routing", will the GetText still work? Reading about all new functions/commands, not always sure what im looking at!

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@Fractured
Try to run this little snippet and tell us if something it's returned:

Func WM_GETTEXT($hdlControlHandle)
    Local $strBuffer = DllStructCreate("char[4096]")
    If @error Then Return ConsoleWrite("Error while creating the struct. Error: " & @error & @CRLF)
    _SendMessage($hdlControlHandle, $WM_GETTEXT, 4096, DllStructGetPtr($strBuffer))
    If @error Then Return ConsoleWrite("Error while sending the Message. Error: " & @error & @CRLF)
    Local $arrContent = StringSplit(DllStructGetData($strBuffer, 1), @CRLF, $STR_NOCOUNT)
    _ArrayDisplay($arrContent)
EndFunc

Replace $hdlControlHandle with your Control Handle ( $CGH_hwnd ) :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Fractured

As requested sir. Nothing was returned in the array :(

snippet.png

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@Fractured
Ok, so, WM_GETTEXT is not the way to take :)
Since now I can see the Treeview structure either, I'd suggest you to see if you can get at least the number of items in the Treeview control with 
_GUICtrlTreeView_GetCount().


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Fractured

The count comes back as zero...so then I wondered if it was a listview...tried _GUICtrlListView_GetView but it returns a zero as well...

Share this post


Link to post
Share on other sites
FrancescoDiMuro

You could try to use _WinAPI_FindWindow to get the handle of the AfxOleControl.
Everywhere I see on Internet, the text from this kind of object is get by WM_GETTEXT Message :)
 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Fractured

Exploring IUIAutomation MS framework to see if that can help me but darn is that complicated!!!

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

×