Jump to content

Question on adding functionality to an application


Recommended Posts

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

Link to comment
Share on other sites

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!!

 

 

Link to comment
Share on other sites

@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

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

@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

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

@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

ALWAYS GOOD TO READ:

 

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...