⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zymodule.bas

📁 利用RS232做通訊 可以執行自動功能 謝謝大家使用
💻 BAS
字号:
Attribute VB_Name = "ZyModule"
 '***************************************************************************
'   Delay Subroutine
'       Delay (integer)
'***************************************************************************
Public Sub DELAY(ByVal Delay_Time!)
    Dim old_time!
    Dim new_time
    
    old_time = Timer
    
Loop_Wait:
    DoEvents
    new_time = Timer
    If new_time < old_time Then new_time = new_time + 86400
    While new_time - old_time >= Delay_Time
    Exit Sub
    Wend
    GoTo Loop_Wait
End Sub
Public Sub CICmd_NoMenu(password As String)
     Dim cr, cc, a, B, i, j, baud_s, baud_f

 '           DELAY 0.5
            
 '                 cr = ComPort.CursorRow
 '                 cc = ComPort.CursorColumn
 '                 ComPort.SelStart = cr * ComPort.Columns
 '                 If ComPort.SelStart = 0 Then            '1'st row must set 80 or it can
 '                       ComPort.SelLength = 350              'not capture the 1st line
 '                 Else
 '                       ComPort.SelLength = 349              '.SelLength must define after .SelStart
 '                 End If                                  'or the row can not be selected
 '
 '           a = InStr(ComPort.SelText, ">")
          
                 
 '           If a = 0 Then
            
                
  '                  If InStr(1, Cmd_Arr(1), "Menu") > 0 Then
  '                      Call GoToMenu(Cmd_Arr(1), password)
  '                  Else
  '                      Call GoToMenuNoSMT(password)
   '                 End If
  '
                          
            
  '          End If
            
        
                  
  '          DELAY 2
            
                  
                  
            ComPort.Output = Cmd_Arr(2)
            ComPort.Output = vbCr
            
     
   '         DELAY 2
            
   '          If Cmd_Arr(3) <> "" Then
   '             ComPort.Output = Cmd_Arr(3)
   '             ComPort.Output = vbCr
    '         End If
   '
            
            
            a = 0
            B = 0
            
        
        If Cmd_Arr(2) = "s r" Or Cmd_Arr(2) = "bridge iface active yes" Or Cmd_Arr(2) = "router iface active yes" Or Cmd_Arr(2) = "sys romr" Or Cmd_Arr(2) = "sys romreset" Or InStr(Cmd_Arr(2), "sys reboot") > 0 Or _
             Cmd_Arr(2) = "atgo" Then
             
            
            
            
           
            
            Call Reboot_sys
            str_buff = "Finished"
            Frm_Series.Run.Caption = str_buff
            Frm_Series.execute_string.Text = ""
            
        Else
        
        
            If InStr(Cmd_Arr(2), "sys baud") > 0 Then
        
                    
                  
                  ComPort.SelStart = 0 * ComPort.Columns
                  If ComPort.SelStart = 0 Then            '1'st row must set 80 or it can
                        ComPort.SelLength = 350              'not capture the 1st line
                  Else
                        ComPort.SelLength = 349              '.SelLength must define after .SelStart
                  End If                                  'or the row can not be selected
        
                  baud_s = InStr(ComPort.SelText, "to")
                  baud_f = InStr(ComPort.SelText, ".")
                  speed = Mid(ComPort.SelText, baud_s + 3, baud_f - baud_s - 3)
                
                    
                              
                  ComPort.Settings = speed + ",n,8,1"
                  
                  
                  
                  For i = 1 To Setting.local_band.ListCount
                     If Setting.local_band.List(i) = speed Then
                        Exit For
                     End If
                  Next i
                  
                  Setting.local_band.ListIndex = i
                  
                  
                  
          
          
          
          
          
            Else
          
        '        j = 0
                
          
         '       Do
                                
         '           Do While (ComPort.CursorColumn <> 0) And a = 0 And b = 0
            
            
         '               cr = ComPort.CursorRow
         '               cc = ComPort.CursorColumn
         '               ComPort.SelStart = cr * ComPort.Columns
         '               If ComPort.SelStart = 0 Then            '1'st row must set 80 or it can
         '                       ComPort.SelLength = 350              'not capture the 1st line
         '               Else
         ''                       ComPort.SelLength = 349              '.SelLength must define after .SelStart
         '               End If                                  'or the row can not be selected
                                         
         '               a = InStr(ComPort.SelText, ">")
         '               b = InStr(ComPort.SelText, ":")
            
          '              DELAY 0.5
          '          Loop
          '
           '             cr = ComPort.CursorRow
           '             cc = ComPort.CursorColumn
           '             ComPort.SelStart = cr * ComPort.Columns
           '             If ComPort.SelStart = 0 Then            '1'st row must set 80 or it can
           '                     ComPort.SelLength = 350              'not capture the 1st line
           '             Else
           '                     ComPort.SelLength = 349              '.SelLength must define after .SelStart
           '             End If                                  'or the row can not be selected
           '
           '             a = InStr(ComPort.SelText, ">")
           '             b = InStr(ComPort.SelText, ":")
            ''
            '
           '             If j > 0 Then ComPort.Output = Chr(vbKeySpace)
            '            DELAY 0.5
            '
             '           j = j + 1
            '
             '   Loop While Not (a > 0 Or b > 0)
        
            End If
   
           '     ComPort.Output = vbCr
                'ComPort.Output = "exit"
          '      ComPort.Output = vbCr
                str_buff = "Finished"
                Frm_Series.Run.Caption = str_buff
                Frm_Series.execute_string.Text = ""
   
      
        End If
               
               
                
End Sub
Public Sub CICmdMore_NoMenu(password As String)
    Dim cr, cc, a, B, i, j, baud_s, baud_f

     '       DELAY 0.5
            
     '             cr = ComPort.CursorRow
     '             cc = ComPort.CursorColumn
     '             ComPort.SelStart = cr * ComPort.Columns
     '             If ComPort.SelStart = 0 Then            '1'st row must set 80 or it can
     '                   ComPort.SelLength = 350              'not capture the 1st line
     '             Else
     '                   ComPort.SelLength = 349              '.SelLength must define after .SelStart
     '             End If                                  'or the row can not be selected
            
     '       a = InStr(ComPort.SelText, ">")
                
     '       If a = 0 Then
            
                
      '              If InStr(1, Cmd_Arr(1), "Menu") > 0 Then
       '                 Call GoToMenu(Cmd_Arr(1), password)
        '            Else
         '               Call GoToMenuNoSMT(password)
          '          End If
             
                          
            
     '       End If
            
        
                  
     '       DELAY 2
               
               
            i = 2
            
            
            
            Do
                
                   
                ComPort.Output = Cmd_Arr(i)
                ComPort.Output = vbCr
                If Cmd_Arr(i + 1) <> "" Then
                    DELAY Cmd_Arr(i + 1)
                End If
                i = i + 2
                
            
            Loop While Len(Cmd_Arr(i)) <> 0
               
                       
 
    
                ComPort.Output = vbCr
                'ComPort.Output = "exit"
      '          ComPort.Output = vbCr
                str_buff = "Finished"
                Frm_Series.Run.Caption = str_buff
                Frm_Series.execute_string.Text = ""
                
                
                
End Sub
Public Sub CICmd(password As String)
    Dim cr, cc, a, B, i, j, baud_s, baud_f

    DELAY 0.5
            
    cr = ComPort.CursorRow
    cc = ComPort.CursorColumn
    ComPort.SelStart = cr * ComPort.Columns
    If ComPort.SelStart = 0 Then            '1'st row must set 80 or it can
        ComPort.SelLength = 100              'not capture the 1st line
    Else
        ComPort.SelLength = 99              '.SelLength must define after .SelStart
    End If                                  'or the row can not be selected
            
    a = InStr(ComPort.SelText, ">")
                   
    If a = 0 Then
        If InStr(1, Cmd_Arr(1), "Menu") > 0 Then
            '祅

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -