Tìm hiểu về code file này

trungkien212000

Yêu THVBA
Mã:
'--------------------------------------------------------------------------------------

' Test checking Serial ==> OK

'--------------------------------------------------------------------------------------

                crt.screen.send "show version | include (Processor)" & vbcr

                crt.Screen.WaitForString "#"

                sn = Split(LTrim(RTrim(crt.Screen.Get((crt.screen.CurrentRow - 1), 1, crt.screen.CurrentRow - 1, 200 ))))

                serial = sn(3)



'--------------------------------------------------------------------------------------

' Test split NAME OF INVENTORY from the Remote ==> OK

'--------------------------------------------------------------------------------------

                crt.screen.send "show inventory | include NAME" & vbcr

                crt.Screen.WaitForString "#"

                line = crt.screen.CurrentRow - 1

                row = 4

                do

                                readlinename = crt.Screen.Get(line, 1, line, 200 )

                                if mid(readlinename,1,3) = "NAM" then

                                                breakname = Split(readlinename, ",")

                                                ws.Cells(row, 1).Value = row-3

                                                ws.Cells(row, 2).Value = Replace(Replace(breakname(0),"NAME: ",""),"""","")

                                                ws.Cells(row, 3).Value = Replace(Replace(RTrim(breakname(1))," DESCR: ",""),"""","")

                                else

                                                exit Do

                                End If

                                line = line - 1

                                row = row + 1

                loop 'while mid(readline,1,3) = "NAM"



'--------------------------------------------------------------------------------------

' Test split PID/SERIAL OF INVENTORY from the Remote ==> OK

'--------------------------------------------------------------------------------------

                crt.screen.send "show inventory | include PID" & vbcr

                crt.Screen.WaitForString "#"

                line = crt.screen.CurrentRow - 1

                row = 4

                do

                                readlinepid = crt.Screen.Get(line, 1, line, 200 )

                                if mid(readlinepid,1,3) = "PID" then

                                '               MsgBox readline

                                                breakpid = Split(readlinepid, ",")

                                '               PID = breakpid(0)

                                '               VID = breakpid(1)

                                '               SN = breakpid(2)

                                '               ws.Cells(row, 5).Value = breakpid(0)

                                '    ws.Cells(row, 6).Value = breakpid(2)

                                                ws.Cells(row, 4).Value = Replace(RTrim(breakpid(0)),"PID: ","")

                                                ws.Cells(row, 5).Value = Replace(RTrim(breakpid(2))," SN:","")

                                '               ws.Cells(row, 4).Value = DESCR

                                else

                                                exit Do

                                End If

                                line = line - 1

                                row = row + 1

                loop while mid(readlinepid,1,3) = "PID"

              

                msgbox "Kiem tra xong serial"



'--------------------------------------------------------------------------------------

' Test split power supply of environment from the Remote ==> In progressing

'--------------------------------------------------------------------------------------

                'crt.Screen.send "enable" & vbcr

                'crt.Screen.WaitForString "#"

                crt.screen.send "show environment | include Supply" & vbcr

                crt.Screen.WaitForString "#"

                '               Router#show environment | include Supply

                '               Power Supply Status:

                '                  12AV  Supply: +11.950 V Normal

                '                  1.5V  Supply: +1.500 V Normal

                '                  1.25V Supply: +1.240 V Normal

                '                  12BV  Supply: +11.980 V Normal

                '                  2.5V  Supply: +2.500 V Normal

                '                  1.05V Supply: +1.070 V Normal

                '                  1.2V  Supply: +1.190 V Normal

                '                  1.8V  Supply: +1.800 V Normal

                '                  0.75V Supply: +0.750 V Normal

                '                  1V    Supply: +0.990 V Normal

                '                  3.3V  Supply: +3.280 V Normal

                '                  5V    Supply: +4.920 V Normal

                linepw = crt.screen.CurrentRow - 1

                rowpw = 4

                do

                                readlinepw = LTrim(RTrim(crt.Screen.Get(linepw, 1, linepw, 200 )))

                                voltID = Trim(crt.Screen.Get(linepw, 1, linepw, 6 ))

                                voltcoms = Trim(crt.Screen.Get(linepw, 17, linepw, 23 ))

                                voltstatus = Trim(crt.Screen.Get(linepw, 27, linepw, 33 ))

                                breakpw = Split(readlinepw)

                                                              

                                ws.Cells(rowpw,6).Value = breakpw(0)

                                ws.Cells(rowpw,7).Value = voltcoms

                                ws.Cells(rowpw,8).Value = voltstatus

                              

                                linepw = linepw - 1

                                rowpw = rowpw + 1

              

                loop while breakpw(0) <> "Power"

                msgbox "Kiem tra xong power"
 
Top