I'm having some problems getting this code to work. When passing a variable argument to the Run command item in the following code:
This basically pulls a file down from my website. Unzips it & runs the virus scan. I'd then like the log emailed once it's completed.
For some reason the $serverinfo variable doesn't get passed into the Run command. If I hardcode the username/serverIP or name it then works. What are the limitations of using a variable within a Run command?
I just need some direction if possible please. Thanks!
#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
#include <GuiConstants.au3>
; If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
GuiCreate("TrendMicro Virus Scan", 211, 189,(@DesktopWidth-211)/2, (@DesktopHeight-189)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$Input_1 = GuiCtrlCreateInput("Enter Name or IP", 10, 40, 150, 20)
;$Input_2 = GuiCtrlCreateInput("", 10, 140, 50, 20)
$Label_3 = GuiCtrlCreateLabel("Name or Server IP", 10, 20, 150, 20)
;$Label_4 = GuiCtrlCreateLabel("Time", 10, 120, 60, 20)
;$Input_5 = GuiCtrlCreateInput("", 10, 90, 190, 20)
;$Label_6 = GuiCtrlCreateLabel("Email Address", 10, 70, 190, 20)
$StartButton = GuiCtrlCreateButton("Start", 110, 140, 90, 30)
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $StartButton
DoCode(GUICtrlRead($Input_1))
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
Func DoCode($serverinfo)
; Connect ssh with account@server use wget to pull the tsc.zip down to the local hdd in the root of C
Run("c:\tsc\ssh.exe administrator@$serverinfo wget -c -m -nH 'http://www.pcmerc.com/tsc.zip' -P '/cygdrive/c/'","", @SW_SHOW)
; Connect ssh with account@server make directory tsc in the root of C
; Run("ssh.exe 'administrator@$IPaddress' mkdir '/cygdrive/c/tsc'","", @SW_HIDE)
; Connect ssh with account@server unzip tsc.zip to the directory tsc in the root of C
; Run("ssh.exe 'administrator@$IPaddress' unzip -d '/cygdrive/c/tsc /cygdrive/c/tsc.zip'","", @SW_HIDE)
; Connect ssh with account@server run a virus scan from the directory tsc in the root of C
; Run("ssh.exe 'administrator@$IPaddress' '/cygdrive/c/tsc/syclean.com /NOGUI /SILENT c:\ /Y'","", @SW_HIDE)
EndFunc
#endregion --- GuiBuilder generated code End ---