Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-09-2017, 12:57 PM
Infodemers Infodemers is offline
Registered User
 
Join Date: Sep 2017
Posts: 2
HostExplorer basic macro to VB Script

Hi,

Any easy way to convert existing Host Explorer Basic macros to VBScript so I can run them within SecureCRT?

Thanks!
Reply With Quote
  #2  
Old 09-11-2017, 07:17 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,556
Hi Infodemers,

What sort of mechanism does HostExplorer use for macros?

Is it an actual scripting language?

For sure there is not a built-in, automatic mechanism in SecureCRT for converting HostExplorer macros, but if you explain what functionality your macros provide, there may be similar example scripts already available for use in SecureCRT.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 09-11-2017, 07:54 AM
Infodemers Infodemers is offline
Registered User
 
Join Date: Sep 2017
Posts: 2
Here is an example of a simple macro I run in a 3270 terminal.
If I could get the equivalents would be a great help.
Like for Hostexplorer.RunCmd, Hostexplorer.WaitIdle,HostExplorer.Keys, etc..

Code:
'================================================
'Reading the ECUupdt file
'================================================
Declare Function DirExists(OrigFile As String)

Sub Main
    dim HostExplorer as Object
    dim HePaire as Object
    dim iIdleTime
    dim root_dir as string
    dim fname as string
    'dim VarNTNumber as Variant
    dim VarAncED As Variant
    dim VarNouED As Variant
    dim action_ipaire
    dim L$
    dim VarIR As Variant
    dim VarNNX As Variant
    dim IntReponse
    dim Compteur
        
iIdleTime = 500 ' Idle time set to 500 milliseconds

'************************************************
'Emplacement du fichier ECUupdt.txt    
'---localement sur "c:\ECU\"
    if DirExists("c:\ECU\") = false Then
        MkDir("c:\ECU\") 'create folder
     End If
    root_dir = "c:\ECU\"
'************************************************
Set HostExplorer = CreateObject("HostExplorer") ' Initialize HostExplorer Object
Set Hepaire = HostExplorer.CurrentHost ' Set Object for current session


 IntReponse = MsgBox("Are you sure you want to run the macro ECU ?",4)
    If (IntReponse = 7) Then 
        
        MsgBox "Action cancelled !" 
        Exit Sub
    
    Else
        fname = root_dir & "ECUupdt.txt"
        Open fname For Input As #1
        Open "c:\ECU\Error.txt" For Output As #2 'open file error.txt for writing
        Print #2, "*****OLD_OE*****NEW_OE*****NT Number*****Error Message***********************"
    End If
    
'--------------------------------------------------------
' Open a dialog box and enter the tel. No. 
'--------------------------------------------------------
     
     Dim cchoices as String
     cchoices = "All" + Chr$(9) + "Nothing"
 
 On Error GoTo CancelPressed
    
    Begin Dialog UserDialog 160,100 ,"Make your choice"
          Text 10, 10, 70, 10, "Type the Frame NXX:"
          TextBox 85, 10, 40, 15, .Text1
          CheckBox 10,30,90,20,"Special ECU", .check1
          OkButton 10,50,40,20
          CancelButton 60,50,40,20,.CancelButton
     End Dialog

   Dim dlg As UserDialog
   Dialog dlg ' show dialog (wait for ok)
  
  ' Retrieve the filename search specs
        
    'Answer = Dialog(mydialogbox )
    NXX$= dlg.Text1
        
        
  If Len(NXX) <> 3 and check1 = 0 Then
    MsgBox "Invalid NXX number. CANCEL"
    Exit Sub
  End If
  

    Compteur = 0    
   
    Do While (Not Eof(1)) 'Loop Until end of file. 
        Input #1,L
    If IsNumeric(mid$(L,1,1)) Then
                      
        VarIR = Mid$(L,1,3)
        VarNNX = Mid$(L,5,3)
        VarAncED = Mid$(L,9,10)
        VarNouED = Mid$(L,20,10)
        
        
        action_ipaire = "LOE/" & VarIR  & "/" & NXX & "/" & VarNouED
       
        
        HePaire.Keys(  action_ipaire  )
        HePaire.RunCmd(  "enter"  )
        HePaire.WaitIdle( 500 )
        
                
        VarMsg = Trim(mid$(HePaire.Row(6),15,6))
        Print #2, L & Space(1) & VarMsg 
        Compteur = Compteur +1   
        HePaire.WaitIdle( 500 )             
                
    End If

    Loop
    
        Print #2, Compteur 
        close #1 'Close file ECUupdt.txt
        Close #2 'Close file error.txt
        
        Exit sub
        
CancelPressed:
        MsgBox "You pressed Cancel!"              
End Sub

    Function DirExists(OrigFile As String)
    Dim fs as object
    Set fs = CreateObject("Scripting.FileSystemObject")
    DirExists = fs.folderexists(OrigFile)
    End Function
Thanks!
Reply With Quote
  #4  
Old 09-11-2017, 08:59 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,556
Hi Infodemers,

I don't know what Hostexplorer.RunCmd or Hostexplorer.WaitIdle, HostExplorer.Keys, etc. is or does. There's not likely to be an exact one-to-one equivalent, although the code looks similar to VBScript.

For this macro example, is it designed to prompt the user to make TAPI/modem connections?

Quote:
Code:
'--------------------------------------------------------
' Open a dialog box and enter the tel. No. 
'--------------------------------------------------------
     
     Dim cchoices as String
     cchoices = "All" + Chr$(9) + "Nothing"
 
 On Error GoTo CancelPressed
    
    Begin Dialog UserDialog 160,100 ,"Make your choice"
          Text 10, 10, 70, 10, "Type the Frame NXX:"
          TextBox 85, 10, 40, 15, .Text1
          CheckBox 10,30,90,20,"Special ECU", .check1
          OkButton 10,50,40,20
          CancelButton 60,50,40,20,.CancelButton
     End Dialog
It seems HostExplorer maybe provided some forms integration, which you won't be able to do with VBScript, but you could use IE as the intermediate mechanism for custom dialogs.

What version of SecureCRT are you using?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 09-11-2017, 01:07 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,556
Hi Infodemers,

A colleague pointed out you would need TN3270 emulation in SecureCRT and existing scripting functions will not work with TN3270.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply

Tags
host explorer , macro , vb script


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 01:07 PM.