I need to have this script reload if someone closes the window. I am new at scripting an need some ideas to help. What we are trying to do is use this on a RDP client machine and it needs to load a signature pad software and also launch Remote desktop using the username of the Enduser. Below is the Script:
'##### GIDE: CREATE FORMS - DO NOT ALTER ANY PART OF THIS BLOCK #######################
'-----------------------------------------------------------------------------------
'---- Script Generated by GIDE - The GooeyScript IDE
'---- Date/Time: 7/13/2009 4:14:15 PM
'-----------------------------------------------------------------------------------
'##### GIDE: MAIN DECLARATIONS - DO NOT ALTER ANY PART OF THIS BLOCK #######################
Option Explicit
Dim objWSHShell
Dim objFSO
Dim bGooeyScriptMissing 'Is GooeyScript.exe missing?
Dim strScriptDir 'This script's path - needed for Windows 2000
'##### GIDE: MAIN DECLARATIONS - DO NOT ALTER ANY PART OF THIS BLOCK #######################
Set objWSHShell = WScript.CreateObject("WScript.Shell")
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
strScriptDir = Replace(Wscript.ScriptFullName, Wscript.ScriptName,"")
If objFSO.fileExists(strScriptDir & "GooeyScript.exe") then
'Enclosed the following filename in quotes just in case the path name contains spaces
objWSHShell.run """" & strScriptDir & "GooeyScript.exe" & """" & "/regserver",1,True 'Register GooeyScript.exe if found
Else
bGooeyScriptMissing = True
End if
If (bGooeyScriptMissing = True) or _
objFSO.fileExists(strScriptDir & "vbrun60sp5.exe") = false or _
objFSO.fileExists(strScriptDir & "picGooeyScript.jpg") = false or _
objFSO.fileExists(strScriptDir & "ProgressBar.gif") = false then
msgbox "This script requires that GooeyScript.exe, GooeyScript images (picGooeyScript.jpg and ProgressBar.gif) and vbrun60sp5.exe are all in the same directory. Please put the required files in this directory."
wscript.quit
End If
If Not objFSO.FileExists(objWSHShell.ExpandEnvironmentStrings("%systemroot%") & "\system32\msvbvm60.dll") Then
'Installing VisualBasic RunTime libraries
objWSHShell.Run """" & Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "vbrun60sp5.exe /q" & """",0, True
End If
'##### GIDE: LOAD FORMS - DO NOT ALTER ANY PART OF THIS BLOCK #######################
Dim NameEntry
Set NameEntry = WScript.CreateObject("GooeyScript.Form", "NameEntry_")
NameEntry.load ,,380,240,"",true,,true
NameEntry.BackColor 240,240,240
NameEntry.ForeColor 18,1,1
'NameEntry.Font False,7.8,"MS Sans Serif"
NameEntry.ontop = true
NameEntry.label.Load "Caption",20,15,180,25,"Enter your username here",True
NameEntry.label.Font "Caption",True,12,"Calibri"
NameEntry.label.BackColor "Caption",240,240,240
NameEntry.label.ForeColor "Caption",18,1,1
NameEntry.textbox.Load "ConnectionString",20,40,265,50,"",0,True
NameEntry.textbox.Font "ConnectionString",False,16,"Calibri"
NameEntry.textbox.BackColor "ConnectionString",255,255,255
NameEntry.textbox.ForeColor "ConnectionString",18,1,1
NameEntry.Button.Load "OK",20,120,260,76,"OK",True
NameEntry.Button.Font "OK",True,13.2,"Calibri"
NameEntry.Button.BackColor "OK",240,240,240
'---- Set control tab orders
'NameEntry.textbox. "ConnectionString",0
'NameEntry.Button.TabIndex "OK",1
Sub NameEntry_ButtonClick(name)
Select Case name
Case "OK"
ProcessClick
End Select
End Sub 'NameEntry_ButtonClick
Sub NameEntry_TextBoxChange(name)
Dim strTemp
Dim intPos
strTemp = NameEntry.TextBox.Text("ConnectionString")
intPos = instr(strTemp, vbCRLF)
if (intPos = 1) then
NameEntry.TextBox.Text "ConnectionString", mid(strTemp, 3, len(strTemp))
NameEntry.MsgBox mid(strTemp, 3, len(strTemp))
ProcessClick
elseif (intPos > 0) then
NameEntry.TextBox.Text "ConnectionString", mid(strTemp, 1, intPos-1)
NameEntry.MsgBox mid(strTemp, 1, intPos-1)
ProcessClick
end if
End Sub 'NameEntry_TextBoxChange
Sub ProcessClick
Dim strTemp
Dim strCMD
' Get the value they typed in
strtemp = NameEntry.TextBox.Text("ConnectionString")
if (trim(strTemp) <> "" ) then
' Start the SegSOCK running
strCMD = "c:\" & "sigsock " & strtemp & " " & "test" & " 6" & """"
objWSHShell.Run "%comspec% /C " & strCMD,0
' Run the RDP session
strCMD = """" & "%systemroot%\system32\mstsc.exe /f /v:" & strtemp & """"
objWSHShell.Run "%comspec% /C " & strCMD,0
NameEntry.ontop = false
' remove the form and quit the script: NO: Leave running
'NameEntry.unload
'wscript.quit
end if
End Sub
'##### GIDE: END CUSTOM CODE - DO NOT ALTER ANY PART OF THE FOLLOWING BLOCK #######################
Sub NameEntry_KeepAlivePing()
NameEntry.keepAlivePong
End Sub
NameEntry.pause
NameEntry.unload
Set NameEntry = Nothing
'##### GIDE: CREATE FORMS - DO NOT ALTER ANY PART OF THIS BLOCK #######################
'-----------------------------------------------------------------------------------
'---- Script Generated by GIDE - The GooeyScript IDE
'---- Date/Time: 7/13/2009 4:14:15 PM
'-----------------------------------------------------------------------------------
'##### GIDE: MAIN DECLARATIONS - DO NOT ALTER ANY PART OF THIS BLOCK #######################
Option Explicit
Dim objWSHShell
Dim objFSO
Dim bGooeyScriptMissing 'Is GooeyScript.exe missing?
Dim strScriptDir 'This script's path - needed for Windows 2000
'##### GIDE: MAIN DECLARATIONS - DO NOT ALTER ANY PART OF THIS BLOCK #######################
Set objWSHShell = WScript.CreateObject("WScript.Shell")
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
strScriptDir = Replace(Wscript.ScriptFullName, Wscript.ScriptName,"")
If objFSO.fileExists(strScriptDir & "GooeyScript.exe") then
'Enclosed the following filename in quotes just in case the path name contains spaces
objWSHShell.run """" & strScriptDir & "GooeyScript.exe" & """" & "/regserver",1,True 'Register GooeyScript.exe if found
Else
bGooeyScriptMissing = True
End if
If (bGooeyScriptMissing = True) or _
objFSO.fileExists(strScriptDir & "vbrun60sp5.exe") = false or _
objFSO.fileExists(strScriptDir & "picGooeyScript.jpg") = false or _
objFSO.fileExists(strScriptDir & "ProgressBar.gif") = false then
msgbox "This script requires that GooeyScript.exe, GooeyScript images (picGooeyScript.jpg and ProgressBar.gif) and vbrun60sp5.exe are all in the same directory. Please put the required files in this directory."
wscript.quit
End If
If Not objFSO.FileExists(objWSHShell.ExpandEnvironmentStrings("%systemroot%") & "\system32\msvbvm60.dll") Then
'Installing VisualBasic RunTime libraries
objWSHShell.Run """" & Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "vbrun60sp5.exe /q" & """",0, True
End If
'##### GIDE: LOAD FORMS - DO NOT ALTER ANY PART OF THIS BLOCK #######################
Dim NameEntry
Set NameEntry = WScript.CreateObject("GooeyScript.Form", "NameEntry_")
NameEntry.load ,,380,240,"",true,,true
NameEntry.BackColor 240,240,240
NameEntry.ForeColor 18,1,1
'NameEntry.Font False,7.8,"MS Sans Serif"
NameEntry.ontop = true
NameEntry.label.Load "Caption",20,15,180,25,"Enter your username here",True
NameEntry.label.Font "Caption",True,12,"Calibri"
NameEntry.label.BackColor "Caption",240,240,240
NameEntry.label.ForeColor "Caption",18,1,1
NameEntry.textbox.Load "ConnectionString",20,40,265,50,"",0,True
NameEntry.textbox.Font "ConnectionString",False,16,"Calibri"
NameEntry.textbox.BackColor "ConnectionString",255,255,255
NameEntry.textbox.ForeColor "ConnectionString",18,1,1
NameEntry.Button.Load "OK",20,120,260,76,"OK",True
NameEntry.Button.Font "OK",True,13.2,"Calibri"
NameEntry.Button.BackColor "OK",240,240,240
'---- Set control tab orders
'NameEntry.textbox. "ConnectionString",0
'NameEntry.Button.TabIndex "OK",1
Sub NameEntry_ButtonClick(name)
Select Case name
Case "OK"
ProcessClick
End Select
End Sub 'NameEntry_ButtonClick
Sub NameEntry_TextBoxChange(name)
Dim strTemp
Dim intPos
strTemp = NameEntry.TextBox.Text("ConnectionString")
intPos = instr(strTemp, vbCRLF)
if (intPos = 1) then
NameEntry.TextBox.Text "ConnectionString", mid(strTemp, 3, len(strTemp))
NameEntry.MsgBox mid(strTemp, 3, len(strTemp))
ProcessClick
elseif (intPos > 0) then
NameEntry.TextBox.Text "ConnectionString", mid(strTemp, 1, intPos-1)
NameEntry.MsgBox mid(strTemp, 1, intPos-1)
ProcessClick
end if
End Sub 'NameEntry_TextBoxChange
Sub ProcessClick
Dim strTemp
Dim strCMD
' Get the value they typed in
strtemp = NameEntry.TextBox.Text("ConnectionString")
if (trim(strTemp) <> "" ) then
' Start the SegSOCK running
strCMD = "c:\" & "sigsock " & strtemp & " " & "test" & " 6" & """"
objWSHShell.Run "%comspec% /C " & strCMD,0
' Run the RDP session
strCMD = """" & "%systemroot%\system32\mstsc.exe /f /v:" & strtemp & """"
objWSHShell.Run "%comspec% /C " & strCMD,0
NameEntry.ontop = false
' remove the form and quit the script: NO: Leave running
'NameEntry.unload
'wscript.quit
end if
End Sub
'##### GIDE: END CUSTOM CODE - DO NOT ALTER ANY PART OF THE FOLLOWING BLOCK #######################
Sub NameEntry_KeepAlivePing()
NameEntry.keepAlivePong
End Sub
NameEntry.pause
NameEntry.unload
Set NameEntry = Nothing