iTpHo3NiX Posted May 7, 2010 Share Posted May 7, 2010 Ok Well I'm working on an AutoIt script that requires user input to change information in a batch file. This is what I've go so far: expandcollapse popup;==================================================== ;=================== FTP Information ================ ;==================================================== ; Version: 2.0.0 ; Language: English ; Author: iTpHo3NiX ;==================================================== ;=================== FTP Information ================ ;==================================================== #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $filemenu, $fileitem, $recentfilesmenu, $separator1 Local $exititem, $helpmenu, $optionmenu, $optionitem, $aboutitem, $okbutton, $cancelbutton Local $msg, $file Local $server, $username, $password, $text #forceref $separator1 GUICreate("FTP Generator by iTpHo3NiX", 400, 250) $server = GUICtrlCreateInput("FTP Server", 40, 25, 245, 21); creats a blank textbox in the GUI window $username = GUICtrlCreateInput("FTP Username", 40, 65, 245, 21); creats a blank textbox in the GUI window $password = GUICtrlCreateInput("FTP Password", 40, 105, 245, 21); creats a blank textbox in the GUI window $filemenu = GUICtrlCreateMenu("File") $fileitem = GUICtrlCreateMenuItem("Open...", $filemenu) $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu) $separator1 = GUICtrlCreateMenuItem("", $filemenu) $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $optionmenu = GUICtrlCreateMenu("Options") $optionitem = GUICtrlCreateMenuItem("Test FTP", $optionitem) $helpmenu = GUICtrlCreateMenu("Help") $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu) $okbutton = GUICtrlCreateButton("Generate", 50, 175, 70, 20) $cancelbutton = GUICtrlCreateButton("Close", 180, 175, 70, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton ExitLoop Case $msg = $fileitem $file = FileOpenDialog("Choose file...", @TempDir, "Batch Files (*.bat)") If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu) Case $msg = $exititem ExitLoop Case $msg = $okbutton $text = FileRead($file) $text = StringReplace($text, "ftpserver", $server) $text = StringReplace($text, "ftpusername", $username) $text = StringReplace($text, "ftppassword", $password) FileDelete($file) FileWrite($file, $text) MsgBox(0, "Generated", "File generated successfully!") Case $msg = $aboutitem MsgBox(0, "About", "This is a FTP Information Generater that is coded in Batch and AutoItv3 by iTpHo3NiX. For and help or questions email iTpHo3NiX at itpho3nix@gmail.com") EndSelect WEnd GUIDelete() Exit EndFunc ;==>_Main Now when I select what file I want to open with the proper string in the file, all it gets replaced with is 3, 4, and 5 for the different things when its supposed to replace with whatever the user input is. Thanks in advanced for any help Link to comment Share on other sites More sharing options...
Developers Jos Posted May 7, 2010 Developers Share Posted May 7, 2010 read all about GuiCtrlRead(). Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
iTpHo3NiX Posted May 7, 2010 Author Share Posted May 7, 2010 Ok do you think you can go more into specifics and when I would use GUICtrlRead()? Link to comment Share on other sites More sharing options...
Developers Jos Posted May 7, 2010 Developers Share Posted May 7, 2010 When you want to "read" the value from the controls and us it in your script. The numbers you see are the Control handles and the actual content is retrieved by doing GuiCtrlRead($Server). SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
iTpHo3NiX Posted May 9, 2010 Author Share Posted May 9, 2010 Thank you with that simple change its completely working now. Thank you. 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