Good Morning All,
I have created a vbs script that updates the time on our cs1000. This script works fine when I am logged on and executes it manually, but because of the "sendkeys and " AppActivate" commands I don't believe it can run as a scheduled task. I am required to use ssh here. I see on this forum that people have used the aspect scripting languange to change the dates on the pbx, but this is not a freeware language. Would appreciate if someone can confirm that this type of vbs script can not be scheduled? Also would appreciate some guidance on an alternative approach. Thanks
Here's my Vbs script.
Option Explicit
On Error Resume Next
Dim Wshshell
Dim d,m,y,h,n,s,dateformat
d = DatePart("d",now)
m = DatePart("m",now)
y = DatePart("yyyy",now)
h = DatePart("h",now)
n = DatePart("n",now)
s = DatePart("s",now)
Dim PUTTYPROFILE
PUTTYPROFILE = "Chanpbx"
dateformat = d & " "& m & " " & y & " " & h & " " & n & " " & s
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "c:\putty.exe -load " & chr(34) & "Chanpbx" & chr(34)
WScript.Sleep 2000
WshShell.AppActivate "HOSTNAME - PuTTY"
WshShell.SendKeys "username{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "password{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "cslogin{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "logi{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "username{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "password"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "ld 2"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "ttad"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "stad " & dateformat
WshShell.SendKeys "{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "****{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "logo{ENTER}"
WScript.Sleep 2000
WshShell.AppActivate "HOSTNAME - PuTTY"
WshShell.SendKeys "%{F4}"
WshShell.SendKeys "{ENTER}"
WScript.Quit
I have created a vbs script that updates the time on our cs1000. This script works fine when I am logged on and executes it manually, but because of the "sendkeys and " AppActivate" commands I don't believe it can run as a scheduled task. I am required to use ssh here. I see on this forum that people have used the aspect scripting languange to change the dates on the pbx, but this is not a freeware language. Would appreciate if someone can confirm that this type of vbs script can not be scheduled? Also would appreciate some guidance on an alternative approach. Thanks
Here's my Vbs script.
Option Explicit
On Error Resume Next
Dim Wshshell
Dim d,m,y,h,n,s,dateformat
d = DatePart("d",now)
m = DatePart("m",now)
y = DatePart("yyyy",now)
h = DatePart("h",now)
n = DatePart("n",now)
s = DatePart("s",now)
Dim PUTTYPROFILE
PUTTYPROFILE = "Chanpbx"
dateformat = d & " "& m & " " & y & " " & h & " " & n & " " & s
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "c:\putty.exe -load " & chr(34) & "Chanpbx" & chr(34)
WScript.Sleep 2000
WshShell.AppActivate "HOSTNAME - PuTTY"
WshShell.SendKeys "username{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "password{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "cslogin{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "logi{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "username{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "password"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "ld 2"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "ttad"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "stad " & dateformat
WshShell.SendKeys "{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "****{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "logo{ENTER}"
WScript.Sleep 2000
WshShell.AppActivate "HOSTNAME - PuTTY"
WshShell.SendKeys "%{F4}"
WshShell.SendKeys "{ENTER}"
WScript.Quit