Jump to content

Read From System Tree - (Moved)


Recommended Posts

Hi All,

I'm fairly new to AutoIT, I've used it once before to automate an install, however I'm now trying to create another automation that is a little bit more in depth.

Basically I am try to create a an automation to send a firmware update through to a piece of hardware that is loaded with faulty firmware. I found that if I keep sending the firmware update through, eventually it will update successfully. Since I have around 20 of these cards to recover I was hoping to create an program to do this for me while I work on other things.

In the program that is used to update the hardware, there is a system tree that states the current Firmware status. if the status is listed as "Boot Mode" the update did not implement successfully, other wise the correct firmware version will be displayed under Receive card MCU

My plan was to run a while loop and and have the condition to repeat the loop that the text "Boot Mode" in present in the system tree.

I was hoping on that the Windows Info tool would be able read the text from the System tree, however I have discovered that is not capable with the Windows Info tool.

Can anyone please give me some assistance with this.

 Firmware-Update.jpg.15a3d36723b91a099a75e794e299339a.jpg

 

Window Info for System Tree

>>>> Window <<<<
Title:    Program loading---the current communication port has device accessed
Class:    WindowsForms10.Window.8.app.0.286424b_r9_ad1
Position:    66, 0
Size:    742, 731
Style:    0x16CA0000
ExStyle:    0x00010101
Handle:    0x00040696

>>>> Control <<<<
Class:    WindowsForms10.SysTreeView32.app.0.286424b_r9_ad1
Instance:    4
ClassnameNN:    WindowsForms10.SysTreeView32.app.0.286424b_r9_ad14
Name:    
Advanced (Class):    [CLASS:WindowsForms10.SysTreeView32.app.0.286424b_r9_ad1; INSTANCE:4]
ID:    1574230
Text:    
Position:    26, 363
Size:    683, 196
ControlClick Coords:    541, 101
Style:    0x56010007
ExStyle:    0x00000200
Handle:    0x00180556

>>>> Mouse <<<<
Position:    636, 490
Cursor ID:    0
Color:    0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
statusStrip1
Information Console
Clear
Hardware Program Version Information
Refresh
Output Port:
Refresh Module MCU
1
Refresh Specified
Refresh All
1
1
Sending Card:
Receiving Card:
Program loading
Extend the operation item 
Read-back of receiving card program 
Program updating 
Update
Browse
Program Path: 
Advanced
C:\Users\psupdate\Desktop\MRV481_V4.3.0.67_(Final Version)
Select the communication port for operation
Reconnect
Communication port for the current operation: 
COM4
1
Device quantity: 


>>>> Hidden Text <<<<
COM4
0%
statusStrip1
Information Console
Clear
Hardware Program Version Information
Refresh
Output Port:
Refresh Module MCU
1
Refresh Specified
Refresh All
1
Sending Card:
Receiving Card:
Program Loading
The Selected Items to Load
NovaProHD All
Receiving Card MCU
Module MCU
Receiving Card FPGA
Sending Card
8028
4C
Reconnect
Update
5C
MCU
Word Lib
WebPage
Image Lib
Select Program
从本地载入
从云端载入
 Receiving card program readback
Browse
C:\Users\psupdate\Desktop\MRV481_V4.3.0.67_(Final Version)
Program Path
Program Version
Program Name
Select Operation Communication Port
Current Operation Communication Port
0
Device Count
Hardware Version Info
Refresh module information
Port
Sending Card
Refresh
1
Receiving Card
Sending Card
Set Position
Refresh All
The program is loading
Select operation communication port
0
Device count
Current operation communication port
COM4
Select the program
从本地载入
从云端载入
Receiving card program readback
Browse
C:\Users\psupdate\Desktop\MRV481_V4.3.0.67_(Final Version)
Program path
Program name
MRV481
Program version
Select Add-ins
Receiving Card MCU
Reconnect
Update
FPGA of receiving card
FPGA of sending card
MCU of sending card
Information Console
Clear
Hardware Program Version Information
Refresh
Output Port:
Refresh Module MCU
1
Refresh Specified
Refresh All
1
Sending Card:
Receiving Card:
statusStrip1
0%
从本地载入
从云端载入
 

#RequireAdmin
AutoItSetOption('SendKeyDelay', 2)
;Run NovaLCT
Run("C:\Users\psupdate\AppData\Roaming\Nova Star\NovaLCT\Bin\NovaLCT.exe")

;Wait for NovaLCT to load
WinWait("NovaLCT V5.4.2")
WinWait("NovaLCT V5.4.2", "1")
;Open User Menu
WinActivate("NovaLCT V5.4.2")
Send("!u")
;Select Advanced user login
Sleep(500)
Send("a",1)
Sleep(500)
;Enter the password "admin" into the textbox
ControlSend("User Login", "", "[CLASS:WindowsForms10.EDIT.app.0.286424b_r9_ad1; INSTANCE:1]", "admin", 1)
;Click the Login Button
ControlClick("User Login", "", "[CLASS:WindowsForms10.BUTTON.app.0.286424b_r9_ad1; INSTANCE:2]")
;type "admin" to access the firmware window
Sleep(500)
WinActivate("NovaLCT V5.4.2")
Send("admin", 1)
;wait for the Firmware update window to open and activet the window
WinWait("Program loading---the current communication port has device accessed")
WinActivate("Program loading---the current communication port has device accessed")
Sleep(1000)
;Click the Refresh Button
ControlClick("Program loading---the current communication port has device accessed", "","[CLASS:WindowsForms10.BUTTON.app.0.286424b_r9_ad1; INSTANCE:44]")
;wait for the hardware infor system tree to update
WinWaitClose("[CLASS:WindowsForms10.Window.8.app.0.286424b_r9_ad1]")
Sleep(2000)
;click the update button
WinActivate("Program loading---the current communication port has device accessed")
ControlClick("Program loading---the current communication port has device accessed", "","[CLASS:WindowsForms10.BUTTON.app.0.286424b_r9_ad1; INSTANCE:51]")
;Click the Refresh Button
ControlClick("Program loading---the current communication port has device accessed", "","[CLASS:WindowsForms10.BUTTON.app.0.286424b_r9_ad1; INSTANCE:44]")
;wait for the hardware infor system tree to update
WinWaitClose("[CLASS:WindowsForms10.Window.8.app.0.286424b_r9_ad1]")
Sleep(2000)
;run the while loop

 

Thanks in advanced

Link to comment
Share on other sites

  • 3 weeks later...

Thanks Nine,

I looked into _GUICtrlTreeView_FindItem, however i'm still having issues with the code actually reading from the System tree.

I created the piece of code below to test if the loop will work.
As a test the code is meant to run notepad if it find the test "Boot" in the system tree. 
however the code has not run notepad yet so I am guessing it cannot read test or it is not looking.

 

#include <GuiTreeView.au3>

Global $hWnd = ControlGetHandle("Program loading---the current communication port has device accessed", "","[CLASS:WindowsForms10.SysTreeView32.app.0.286424b_r9_ad1; INSTANCE:4]")

$searchText = "Boot"
$hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True)
WinActivate("Program loading---the current communication port has device accessed")
Sleep(1000)
While $hItemFound
   Run("notepad.exe")
WEnd

Window Info for System Tree

>>>> Window <<<<
Title:    Program loading---the current communication port has device accessed
Class:    WindowsForms10.Window.8.app.0.286424b_r9_ad1
Position:    66, 0
Size:    742, 731
Style:    0x16CA0000
ExStyle:    0x00010101
Handle:    0x00040696

>>>> Control <<<<
Class:    WindowsForms10.SysTreeView32.app.0.286424b_r9_ad1
Instance:    4
ClassnameNN:    WindowsForms10.SysTreeView32.app.0.286424b_r9_ad14
Name:    
Advanced (Class):    [CLASS:WindowsForms10.SysTreeView32.app.0.286424b_r9_ad1; INSTANCE:4]
ID:    1574230
Text:    
Position:    26, 363
Size:    683, 196
ControlClick Coords:    541, 101
Style:    0x56010007
ExStyle:    0x00000200
Handle:    0x00180556

>>>> Mouse <<<<
Position:    636, 490
Cursor ID:    0
Color:    0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
statusStrip1
Information Console
Clear
Hardware Program Version Information
Refresh
Output Port:
Refresh Module MCU
1
Refresh Specified
Refresh All
1
1
Sending Card:
Receiving Card:
Program loading
Extend the operation item 
Read-back of receiving card program 
Program updating 
Update
Browse
Program Path: 
Advanced
C:\Users\psupdate\Desktop\MRV481_V4.3.0.67_(Final Version)
Select the communication port for operation
Reconnect
Communication port for the current operation: 
COM4
1
Device quantity: 


>>>> Hidden Text <<<<
COM4
0%
statusStrip1
Information Console
Clear
Hardware Program Version Information
Refresh
Output Port:
Refresh Module MCU
1
Refresh Specified
Refresh All
1
Sending Card:
Receiving Card:
Program Loading
The Selected Items to Load
NovaProHD All
Receiving Card MCU
Module MCU
Receiving Card FPGA
Sending Card
8028
4C
Reconnect
Update
5C
MCU
Word Lib
WebPage
Image Lib
Select Program
从本地载入
从云端载入
 Receiving card program readback
Browse
C:\Users\psupdate\Desktop\MRV481_V4.3.0.67_(Final Version)
Program Path
Program Version
Program Name
Select Operation Communication Port
Current Operation Communication Port
0
Device Count
Hardware Version Info
Refresh module information
Port
Sending Card
Refresh
1
Receiving Card
Sending Card
Set Position
Refresh All
The program is loading
Select operation communication port
0
Device count
Current operation communication port
COM4
Select the program
从本地载入
从云端载入
Receiving card program readback
Browse
C:\Users\psupdate\Desktop\MRV481_V4.3.0.67_(Final Version)
Program path
Program name
MRV481
Program version
Select Add-ins
Receiving Card MCU
Reconnect
Update
FPGA of receiving card
FPGA of sending card
MCU of sending card
Information Console
Clear
Hardware Program Version Information
Refresh
Output Port:
Refresh Module MCU
1
Refresh Specified
Refresh All
1
Sending Card:
Receiving Card:
statusStrip1
0%
从本地载入
从云端载入

Link to comment
Share on other sites

Try this code.  Run it from Scite.  Report console.

#include <GuiTreeView.au3>

Opt("WinTitleMatchMode", -1)
Global $hWnd = WinGetHandle("Program loading")
ConsoleWrite($hWnd & @CRLF)
Global $hCtrl = ControlGetHandle($hWnd, "","[CLASS:WindowsForms10.SysTreeView32.app.0.286424b_r9_ad1; INSTANCE:4]")
ConsoleWrite($hCtrl & @CRLF)

$iCount = _GUICtrlTreeView_GetCount($hCtrl)
ConsoleWrite($iCount & @CRLF)

 

Link to comment
Share on other sites

Hi Nine,

please see the report console information below

 

Quote

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\psupdate\Desktop\console report.au3"    
0x000F07CE
0x001007E4
0
>Exit code: 0    Time: 1.551

 

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