Here is what I am working on....
Code:
;*************************************************************************
; Script Name: NetDev_Config_Change
; Author: WAKimball
; Date: 7/25/2006
; Description: Use this script to apply changes to all network devices.
; This will apply the changes globally to ALL devices in the file
; DeviceList.txt. Input file should be located in the script dir, and
; named Input.txt
;
;*************************************************************************
;Script Options
$SO=SETOPTION("Explicit", "ON")
$SO=SETOPTION("NoMacrosInStrings", "ON")
$SO=SETOPTION("NoVarsInStrings", "ON")
$SO=SETOPTION("WrapAtEOL", "ON")
BREAK ON
Dim $SO, $FH, $Device[], $Input[], $R, $$
$FH=FreeFileHandle()
If Open($FH, @ScriptDir+"\devicelist.txt",2)= 0
$R = Readline($fh)
$SO = 0
While @Error = 0
$Device[$SO] = $R
$SO = $SO + 1
Redim Preserve $Device[$SO]
$R = Readline($fh)
Loop
Close($FH)
Else ? "Error opening file"
EndIF
If Open($FH, @ScriptDir+"\input.txt,2)=0
$R = Readline($fh)
$SO = 0
While @Error = 0
$Input[$SO] = $R
$SO = $SO + 1
Redim Preserve $Input[$SO]
$R = Readline($fh)
Loop
Close($FH)
Else ? "Error opening file"
EndIF
For each $SO in $Device
CLS
? "Please connect to: " + $SO
? "Press -C- once connected and in Exec mode"
Press()
If Setfocus("Telnet "+$SO) = 0
Send($Input)
Else
If Setfocus("Putty "+$SO) = 0
Send($Input)
Else
? "Unable to find Window"
EndIf
EndIf
Next
Function Press()
Dim $
While $ <> "C"
Get $
Loop
EndFunction
Function Send($Input)
For each $$ in $Input
CheckString($$)
SendKeys($checkstring)
Next
EndFunction
Function CheckString ($letters)
Dim $letters, $a, $i, $s
$a = ""
For $i= 1 to Len($letters)
$a = Substr($letters, $i, 1)
Select
Case $a = "+"
$a = "{+}"
Case $a = "^"
$a = "{^}"
Case $a = "~"
$a = "{~}"
Case $a = "("
$a = "{(}"
Case $a = ")"
$a = "{)}"
Case $a = "{"
$a = "{{}"
Case $a = "}"
$a = "{}}"
EndSelect
$s = $s+$a
Next
$checkstring = $s
EndFunction