pcjunki Posted August 8, 2012 Posted August 8, 2012 i'm getting an error on a new gui i'm making, but i dont know what to do here is my code i'm just at a loss and stumped #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("PSTOOL gui", 458, 290, 218, 329) $Input1 = GUICtrlCreateInput("", 8, 40, 121, 21) $Label2 = GUICtrlCreateLabel("username", 8, 80, 50, 17) $Input2 = GUICtrlCreateInput("", 8, 96, 121, 21) $Label3 = GUICtrlCreateLabel("pwd", 8, 136, 24, 17) $Input3 = GUICtrlCreateInput("", 8, 152, 121, 21) $Label4 = GUICtrlCreateLabel("Command", 8, 184, 51, 17) $Input4 = GUICtrlCreateInput("", 8, 200, 409, 21) $Button1 = GUICtrlCreateButton("GO", 8, 232, 75, 25) $Label1 = GUICtrlCreateLabel("Computername", 8, 16, 75, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $pc = GUICtrlRead($input1) $username = GUICtrlRead($input2) $pwd = GUICtrlRead($input3) $command = GUICtrlRead($input4) call($pc,$username,$pwd,$command) EndSwitch WEnd Func($pc) ShellExecute("c:\pstools\psexec.exe", "\\" & $pc &" -u "& $username" -p "& $pwd" -c "& $command"") EndFunc
water Posted August 8, 2012 Posted August 8, 2012 Can you post the error message you get? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
pcjunki Posted August 8, 2012 Author Posted August 8, 2012 Func($pc) ShellExecute("c:pstoolspsexec.exe", "" & $pc &" -u "& $username" -p "& $pwd" -c "& $command"") EndFunc (33) : ==> Badly formatted "Func" statement.:
water Posted August 8, 2012 Posted August 8, 2012 The name of the function is missing. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
pcjunki Posted August 8, 2012 Author Posted August 8, 2012 omg...how did i miss that...haha no errors popping up now, but now when i click on "go" nothing happens
water Posted August 8, 2012 Posted August 8, 2012 This works fine for me: #include <GUIConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("PSTOOL gui", 458, 290, 218, 329) $Input1 = GUICtrlCreateInput("", 8, 40, 121, 21) $Label2 = GUICtrlCreateLabel("username", 8, 80, 50, 17) $Input2 = GUICtrlCreateInput("", 8, 96, 121, 21) $Label3 = GUICtrlCreateLabel("pwd", 8, 136, 24, 17) $Input3 = GUICtrlCreateInput("", 8, 152, 121, 21) $Label4 = GUICtrlCreateLabel("Command", 8, 184, 51, 17) $Input4 = GUICtrlCreateInput("", 8, 200, 409, 21) $Button1 = GUICtrlCreateButton("GO", 8, 232, 75, 25) $Label1 = GUICtrlCreateLabel("Computername", 8, 16, 75, 17) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $pc = GUICtrlRead($Input1) $username = GUICtrlRead($Input2) $pwd = GUICtrlRead($Input3) $command = GUICtrlRead($Input4) PS($pc, $username, $pwd, $command) EndSwitch WEnd Func PS($pc, $username, $pwd, $command) MsgBox(0, "", "$pc: " & $pc & @CRLF & "$username: " & $username & @CRLF & "$pwd: " & $pwd & @CRLF & "$command: " & $command) ; ShellExecute("c:pstoolspsexec.exe", "" & $pc &" -u "& $username" -p "& $pwd" -c "& $command"") EndFunc ;==>PS My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
pcjunki Posted August 8, 2012 Author Posted August 8, 2012 sweet, i got that working now with your modified code! woohoobut now as i'm trying to get my line workin...i have "another" error(36) : ==> Error in expression.:ShellExecute("c:pstoolspsexec.exe", "" & $pc &" -u "& $username" -p "& $pwd" "& $command )ShellExecute("c:pstoolspsexec.exe", ^ ERRORi think i have to many quotes, or quotes in the wrong place somewhere
water Posted August 8, 2012 Posted August 8, 2012 No problem with quotes but with ampersands: two & were missing. Try: ShellExecute("c:pstoolspsexec.exe", "" & $pc & " -u " & $username & " -p " & $pwd & " " & $command) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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