JohnRichard Posted August 13, 2008 Share Posted August 13, 2008 hi to all. again i need your help. i have this script that will ping the computer in our network. If it is online it will execute a program (an AutoIT script that is compiled to exe). My problem is, how will i execute the script remotely on the computer. The script executes locally on my local computer but not on the remote computer. Please help me with my script.... Below is my script: #NoTrayIcon #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GuiEdit.au3> #include <File.au3> Opt("GUIOnEventMode", 1) Global $Form1 = GUICreate("Computer", 506, 314, 201, 346) GUISetOnEvent($GUI_EVENT_CLOSE, "Button3Click") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") Global $Label1 = GUICtrlCreateLabel("PC Name / IP Address", 18, 28, 131, 17) GUICtrlSetFont($Label1, 9, 800, 0, "MS Sans Serif") GUICtrlSetOnEvent($Label1, "Label1Click") Global $Input = GUICtrlCreateInput("", 153, 24, 209, 21) GUICtrlSetOnEvent(-1, "Change") Global $Computer_Button = GUICtrlCreateButton("Check Computer", 377, 22, 105, 25, 0) GUICtrlSetFont($Computer_Button, 8, 800, 0, "MS Sans Serif") GUICtrlSetOnEvent($Computer_Button, "Check_Computer_Button_Click") Global $Temp_Checkbox = GUICtrlCreateCheckbox("Delete Temp Files", 89, 88, 105, 17) GUICtrlSetOnEvent($Temp_Checkbox, "Checkbox1Click") Global $EndPoint_Checkbox = GUICtrlCreateCheckbox("Install Endpoint", 257, 88, 113, 17) GUICtrlSetOnEvent($EndPoint_Checkbox, "Checkbox2Click") Global $Edit = GUICtrlCreateInput("", 55, 144, 401, 80, $ES_READONLY) GUICtrlSetOnEvent(-1, "Change") Global $GO_Button = GUICtrlCreateButton("GO", 296, 256, 81, 33, 0) GUICtrlSetFont($GO_Button, 9, 800, 0, "MS Sans Serif") GUICtrlSetOnEvent($GO_Button, "GO_Button_Click") Global $Exit_Button = GUICtrlCreateButton("Exit", 401, 256, 82, 33, 0) GUICtrlSetFont($Exit_Button, 9, 800, 0, "MS Sans Serif") GUICtrlSetOnEvent($Exit_Button, "Button3Click") GUISetState(@SW_SHOW) While 1 $Form1 = GUIGetMsg() Switch $Form1 Case $GUI_EVENT_CLOSE Button3Click() EndSwitch WEnd Func Check_Computer_Button_Click() Local $check_computer = GUICtrlRead($Input) $ping = Ping($check_computer, 1000) If $ping Then GUICtrlSetData($Edit, "Computer is ONLINE") Else SoundPlay(@WindowsDir & "\media\Windows XP Hardware Fail.wav",1) ;SoundPlay(@WindowsDir & "\media\tada.wav",1) ;MsgBox(16, "", "Computer cannot be located. Either it is OFFLINE or DISCONNECTED.") GUICtrlSetData($Edit, "Computer cannot be located. Either it is OFFLINE or DISCONNECTED.") If $check_computer = "" Then ;SoundPlay(@WindowsDir & "\media\Windows XP Hardware Fail.wav",1) GUICtrlSetData($Edit, "") GUICtrlSetData($Edit, "No computer specified. Please type PC Name or IP Address.") EndIf EndIf EndFunc Func GO_Button_Click() Local $check_computer = GUICtrlRead($Input), $filepath = "\\test\sample$\Clean-Up.exe", $destination = $check_computer & @SystemDir If $check_computer = "" Then GUICtrlSetData($Edit, "No computer specified. Please type PC Name or IP Address.") Else GUICtrlSetData($Edit, "" & @CRLF) GUICtrlSetData($Edit, "Performing action on computer............" & @CRLF & @CRLF, 1) FileInstall($filepath, $destination , 1) Run("Clean-Up.exe", $check_computer & @SystemDir) GUICtrlSetData($Edit, "Task(s) completed!" & @CRLF, 1) If $check_computer <> "04" And "10.14." Then GUICtrlSetData($Edit, "Cannot perform action!") $ping2 = Ping($check_computer, 3000) If $ping2 Then GUICtrlSetData($Edit, "" & @CRLF) GUICtrlSetData($Edit, "Performing action on computer............" & @CRLF & @CRLF, 1) Run("Notepad.exe", @SystemDir) ;FileInstall($filepath, $destination , 1) GUICtrlSetData($Edit, "Task(s) completed!" & @CRLF, 1) Else GUICtrlSetData($Edit, "Cannot perform action! Either the PC or IP Address is invalid.") EndIf EndIf EndIf EndFunc Func Button3Click() Exit EndFunc Func Change() EndFunc Func Checkbox1Click() EndFunc Func Checkbox2Click() EndFunc Func Form1Maximize() EndFunc Func Form1Minimize() EndFunc Func Form1Restore() EndFunc Func Label1Click() EndFunc Link to comment Share on other sites More sharing options...
ksmith247 Posted August 13, 2008 Share Posted August 13, 2008 Look at Q9. How can I run my script on a remote computer over the network? Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now