2013年8月5日 星期一

[SecureCRT] Script example


[SecureCRT] Script example

#$language = "VBScript"

#$interface = "1.0"

 

' This automatically generated script may need to be

' edited in order to work correctly.

 

Sub Main

    crt.Screen.Synchronous = True

    Dim env, flie, full, medium

    file = "happy-1.1.0.14-" & Right(DatePart("yyyy", Now()),2) & Right("0" & DatePart("m",Now()),2) & Right("0" & DatePart("d",Now()),2) &".img"

    full = file & ".full"

    medium = file & ".medium"

    'crt.Screen.Send VbCr

 

    env = crt.Screen.ReadString("normal", "full", "medium", "uboot", VbCr)

    select case crt.Screen.MatchIndex

    case 1

        crt.Screen.Send VbCr

        crt.Screen.Send "reboot" & VbCr

        crt.Screen.WaitForString "Press SPACE to abort autoboot in 1 second(s)"

        crt.Screen.Send " " & VbCr

        crt.Screen.WaitForString "=>"

        crt.Screen.Send "set UBFINAME1 " & file & VbCr

        crt.Screen.WaitForString "=>"

        crt.Screen.Send "run update1" & VbCr

        crt.Screen.WaitForString "Writing to Flash"

        crt.Screen.Send VbCr

        crt.Screen.WaitForString "=>"

        crt.Screen.Send "reset" & VbCr

        msgbox "Brun in " & file & "pass"

    case 2

        crt.Screen.Send VbCr

        crt.Screen.Send "reboot" & VbCr

        crt.Screen.WaitForString "Press SPACE to abort autoboot in 1 second(s)"

        crt.Screen.Send " " & VbCr

        crt.Screen.WaitForString "=>"

        crt.Screen.Send "set UBFINAME1 " & full & VbCr

        crt.Screen.Send "run updateall" & VbCr

        crt.Screen.WaitForString "Writing to Flash"

        crt.Screen.Send VbCr

        crt.Screen.WaitForString "=>"

        crt.Screen.Send "reset" & VbCr

        msgbox "Brun in " & full & "pass"

    case 3

        crt.Screen.Send VbCr

        crt.Screen.Send "reboot" & VbCr

        crt.Screen.WaitForString "Press SPACE to abort autoboot in 1 second(s)"

        crt.Screen.Send " " & VbCr

        crt.Screen.WaitForString "=>"

        crt.Screen.Send "set UBFINAME1 " & medium & VbCr

        crt.Screen.WaitForString "=>"

        crt.Screen.Send "run update1" & VbCr

        crt.Screen.WaitForString "Writing to Flash"

        crt.Screen.Send VbCr

        crt.Screen.WaitForString "=>"

        crt.Screen.Send "reset" & VbCr

        msgbox "Brun in " & medium & "pass"

    case 4

        crt.Screen.Send VbCr

        crt.Screen.Send "reboot" & VbCr

        crt.Screen.WaitForString "Press SPACE to abort autoboot in 1 second(s)"

        crt.Screen.Send " " & VbCr

        crt.Screen.WaitForString "=>"

        crt.Screen.Send "set UBFINAME1 " & file

    case Else

        msgbox "TimeOut : Unknown brun in command " & date

    end select

End Sub

 


Related Posts:

0 意見:

張貼留言