FitzChivalry Posted January 22, 2007 Posted January 22, 2007 Hey, I'm writing a program, and I want to make it possible to get multiple lines of input from the user using one textbox. right now I'm just using a InputBox: $site = InputBox("Whatever", "Input multiple lines of text") This works great and wonderfully for one line of text. The question is, how do I make it possible to enter multiple lines? I've looked around on the forums and havn't been able to find anything... Something that will read all the lines and store it in an array or something like that. Any suggestions would be very gratefully received. Thanks!
herewasplato Posted January 22, 2007 Posted January 22, 2007 Are you planning on typing or pasting the info into whatever user interface you use? If paste, the just StringSplit ClipGet using @CR ro @CRLF as needed. [size="1"][font="Arial"].[u].[/u][/font][/size]
FitzChivalry Posted January 22, 2007 Author Posted January 22, 2007 I will be pasting, so thanks for the answer! out of curiosity, what would be a good way to do it if I was typing it in?
Shevilie Posted January 22, 2007 Posted January 22, 2007 http://www.autoitscript.com/autoit3/docs/f...lCreateEdit.htm Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
herewasplato Posted January 22, 2007 Posted January 22, 2007 http://www.autoitscript.com/autoit3/docs/f...lCreateEdit.htmyep :-) [size="1"][font="Arial"].[u].[/u][/font][/size]
luvmachine Posted January 22, 2007 Posted January 22, 2007 If you are set on using a inputbox rather than a gui, you can have the user type in "@CRLF" or "@CR" or any other symbol of your choice, then run a StringReplace() on it, looking for "@CRLF" in the quotes, and replacing it with a @CRLF without the quotes.
FitzChivalry Posted January 22, 2007 Author Posted January 22, 2007 (edited) Thanks for your help everyone! I'll put my code here in case someone else has the same question in the future... #include <GUIConstants.au3> GUICreate("Site Submission") Opt("GUICoordMode", 1) $Button_1 = GUICtrlCreateButton("ok", 10, 30, 100) $Button_2 = GUICtrlCreateButton("cancel", 0, -1) $myedit = GUICtrlCreateEdit("Enter url's here", 50, 50, 300, 150, $ES_AUTOVSCROLL + $WS_VSCROLL + $es_wantreturn) GUICtrlSetPos($Button_1, 10, 10, 70) GUICtrlSetPos($Button_2, 80, 10, 70) GUISetState() ; will display the box with 2 buttons and the textarea ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 ExitLoop Case $msg = $Button_2 Exit EndSelect WEnd $sites = GUICtrlRead($myedit) $lines = StringSplit($sites, @CRLF) With this they can type or paste whatever they want into the box, and then the array $lines has all the lines in it. Edit:typos :-) Edited January 22, 2007 by FitzChivalry
herewasplato Posted January 22, 2007 Posted January 22, 2007 I would suggest adding a flag to the StringSplit line:$lines = StringSplit($sites, @CRLF, 1) For $i = 1 To $lines[0] MsgBox(0, "", $lines[$i]) Next [size="1"][font="Arial"].[u].[/u][/font][/size]
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