Doxie Posted July 21, 2011 Posted July 21, 2011 Hi,I made a simple script, and it all worked without GUI.Now when i'm trying to add a GUI, i cant get it to work,the script does not "fetch" the input from "userid", "password" or "computer"If i for example try MsgBox(0, 'Testing', $userid) it only return a number, for example 7.Could anyone see what i have done wrong? At the bottom i post the code thats working.Thanks in advanceexpandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("VPN Fix", 368, 203, 1713, 326) $GroupBox1 = GUICtrlCreateGroup("", 8, 1, 265, 193) $userid = GUICtrlCreateInput("", 16, 16, 121, 21) GUICtrlSetTip(-1, "Admin account") $password = GUICtrlCreateInput("", 16, 48, 121, 21) $computer = GUICtrlCreateInput("", 16, 80, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 286, 11, 75, 25) $Button2 = GUICtrlCreateButton("&Cancel", 285, 44, 75, 25) $Button3 = GUICtrlCreateButton("&Help", 285, 76, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $msg = GUIGetMsg() Select Case $msg = $Button1 RunAs($userid, "EUR", $passwd, 0, "sc \\" & $comp & " stop VPN1", @SystemDir) RunAs($userid, "EUR", $passwd, 0, "sc \\" & $comp & " stop VPN2", @SystemDir) RunAs($userid, "EUR", $passwd, 0, FileCopy("filexxx", "\\" & $comp & "\c$", 1), @SystemDir) RunAs($userid, "EUR", $passwd, 0, "sc \\" & $comp & " start VPN1", @SystemDir) RunAs($userid, "EUR", $passwd, 0, "sc \\" & $comp & " start VPN2", @SystemDir) Case $msg = $Button2 Winclose("VPN Fix") Case $msg = $Button3 ;Still in progress EndSelect Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndWorking script$uid = InputBox("VPN Fix", "Enter your Admin ID.", "", "") $passwd = InputBox("VPN Fix", "Enter your password.", "", "*") $comp = InputBox("VPN Fix", "Enter Computername.", "", "") RunAs($uid, "EUR", $passwd, 0, "sc \\" & $comp & " stop VPN1", @SystemDir) RunAs($uid, "EUR", $passwd, 0, "sc \\" & $comp & " stop VPN2", @SystemDir) RunAs($uid, "EUR", $passwd, 0, FileCopy("Filexxx", "\\" & $comp & "\c$\Shortcut", 1), @SystemDir) RunAs($uid, "EUR", $passwd, 0, "sc \\" & $comp & " start VPN1", @SystemDir) RunAs($uid, "EUR", $passwd, 0, "sc \\" & $comp & " start VPN2", @SystemDir) Were ever i lay my script is my home...
wakillon Posted July 21, 2011 Posted July 21, 2011 you need tu use GUICtrlRead to read your inputs ! $userid = GUICtrlRead ( $userid ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Doxie Posted July 21, 2011 Author Posted July 21, 2011 you need tu use GUICtrlRead to read your inputs ! $userid = GUICtrlRead ( $userid ) Thanks alot, i can only blame it on the early morning... Were ever i lay my script is my home...
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