Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Multi-line input boxes


  • Please log in to reply
11 replies to this topic

#1 aommaster

aommaster

    Adventurer

  • Active Members
  • PipPip
  • 140 posts

Posted 28 December 2008 - 07:52 PM

Hey everyone

Can inputboxes (e.g. $string=inputbox(etc.)) be mutlined? If so, how do I make them?

If not, what would be the best input method for a user to enter a multilined string without the use of a GUI edit box?

Thanks :)







#2 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 28 December 2008 - 07:56 PM

multilined string without the use of a GUI edit box?

just create a GUI with an edit :) There is no other way...
*GERMAN* Posted Image [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

#3 Pain

Pain

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 627 posts

Posted 28 December 2008 - 08:00 PM

InputBox can only have 254 characters. However the Inputbox is a normal GUI with GUICtrlCreateInput so no they can't be multilined (atleast not the input, the message can if you use @crlf)

But you can make a custom Inputbox with a GUICtrlCreateEdit instead and some buttons.

But since you said without editbox you can always use a file and read from it :)

Edit: damn Andy were faster

Edited by Pain, 28 December 2008 - 08:01 PM.


#4 FireFox

FireFox

    It slips through our fingers, like a fist full of sand.

  • MVPs
  • 5,382 posts

Posted 28 December 2008 - 08:04 PM

@aommaster
#Include <EditConstants.au3> GuiCreate("GUI",400,400) GuiCtrlCreateEdit("Edit",5,5,390,390,$ES_MULTILINE) GuiSetState() While 1 Sleep(250) WEnd


Cheers, FireFox.

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.

Hardware : Intel® Core™ i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !


#5 aommaster

aommaster

    Adventurer

  • Active Members
  • PipPip
  • 140 posts

Posted 28 December 2008 - 08:04 PM

Hmm.. so would the best way be by creating a child window with a multiline edit box, and pass the variable back to the main program once the user has completed the input?

#6 herewasplato

herewasplato

    Most Senile Poster

  • Active Members
  • PipPipPipPipPipPip
  • 4,426 posts

Posted 28 December 2008 - 08:06 PM

ClipGet
..

#7 aommaster

aommaster

    Adventurer

  • Active Members
  • PipPip
  • 140 posts

Posted 28 December 2008 - 08:07 PM

ClipGet

Doesn't suit my purpose, because the user has to input a custom set of lines that aren't copied from the clipboard

Edited by aommaster, 28 December 2008 - 08:08 PM.


#8 aommaster

aommaster

    Adventurer

  • Active Members
  • PipPip
  • 140 posts

Posted 28 December 2008 - 08:10 PM

@aommaster

#Include <EditConstants.au3> GuiCreate("GUI",400,400) GuiCtrlCreateEdit("Edit",5,5,390,390,$ES_MULTILINE) GuiSetState() While 1 Sleep(250) WEnd


Cheers, FireFox.

Hi Firefox!

Didn't see your reply until I posted mine. Thanks for your code :)

#9 herewasplato

herewasplato

    Most Senile Poster

  • Active Members
  • PipPipPipPipPipPip
  • 4,426 posts

Posted 28 December 2008 - 08:14 PM

Doesn't suit my purpose, because the user has to input a custom set of lines that aren't copied from the clipboard

I have several scripts that prompt the user to enter data into a certain app - then either the user puts it into the clipboard or the script gets it from the edit control. It comes in handy if the info needs to retain formatting.

...but like you said - it might not work for your needs. You just really limited the options when you said no GUI :-)
..

#10 aommaster

aommaster

    Adventurer

  • Active Members
  • PipPip
  • 140 posts

Posted 28 December 2008 - 08:17 PM

...but like you said - it might not work for your needs. You just really limited the options when you said no GUI :-)

Yeah.. reason I wanted to avoid a GUI window is because this script is already running from a GUI, and because I'm not too comfortable with GUI coding just yes (I can only do the basic things such as define a control and make it do stuff, as well as read and write to it), I'm afraid that creating a child window would be a one way ticket to disaster :)

Oh well, here goes nothing... another new learning experience for me.

Thanks everyone!

#11 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 28 December 2008 - 08:36 PM

This should work just like inputbox:
AutoIt         
$sText = '' For $i = 0 To 5000     $sText &= Chr(Random(65, 90, 1)) Next MsgBox(0, '', _MLInputBox("Testbox", "Test", $sText, 0, 800, -1, -1) & @error) InputBox("t", "") ;=============================================================================== ; ; Function Name:   _MLInputBox( ; Description::    Multiline Inputbox ; Parameter(s):    same as Inputbox, but without Psswordchar ; Requirement(s): ; Return Value(s): same as InputBox ; Author(s):       Oscar, Prog@ndy ; ;=============================================================================== ; Func _MLInputBox($title, $prompt, $Default = "", $width = 0, $height = 0, $left = Default, $top = Default, $timeOut = 0, $hWnd = 0)     Local $OnEventMode = Opt('GUIOnEventMode', 0)     Local $text = ""     If $width < 400 Then $width = 400     If $height < 330 Then $height = 330     Local $widthAddition = $width-400     Local $heightAddition = $height-330     Local $error = 0     Local $hGui = GUICreate($title, $width, $height, $left, $top, 0x00C00000+0x00080000,0,$hWnd)     If @error Then         $error = 3     Else         GUICtrlCreateLabel($prompt, 5, 5, 390, 90)         If @error Then $error = 3         Local $Edit = GUICtrlCreateEdit($Default, 5, 105, 390+$widthAddition, 190+$heightAddition)         If @error Then $error = 3         Local $hOK = GUICtrlCreateButton('&OK', 70, 300+$heightAddition, 80, 25)         If @error Then $error = 3         Local $htime = GUICtrlCreateLabel('', 170, 305+$heightAddition, 50, 20)         If @error Then $error = 3         Local $hCancel = GUICtrlCreateButton('&Cancel', 230, 300+$heightAddition, 80, 25)         If @error Then $error = 3         GUISetState(@SW_SHOW, $hGui)         If @error Then $error = 3         Local $timer = TimerInit(), $s1, $s2, $msg         Do             $msg = GUIGetMsg(1)             If $msg[1] = $hGui Then             Switch $msg[0]                 Case 0xFFFFFFFD, $hCancel ; 0xFFFFFFFD = $GUI_EVENT_CLOSE                     $error = 1                     ExitLoop                 Case $hOK                     ExitLoop             EndSwitch             EndIf             If $timeOut > 0 And TimerDiff($timer) >= $timeOut Then $error = 2             $s1 = Round(($timeOut - TimerDiff($timer)) / 1000)             If $timeOut And $s1 <> $s2 Then                 GUICtrlSetData($htime, $s1 & "s")                 $s2 = $s1             EndIf         Until $error         If Not $error Then $text = GUICtrlRead($Edit)         GUIDelete($hGui)         Opt('GUIOnEventMode', $OnEventMode)     EndIf     SetError($error)     Return $text EndFunc   ;==>_MLInputBox

Edited by ProgAndy, 28 December 2008 - 08:37 PM.

*GERMAN* Posted Image [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

#12 aommaster

aommaster

    Adventurer

  • Active Members
  • PipPip
  • 140 posts

Posted 28 December 2008 - 08:41 PM

Thanks for that code! It's brilliant :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users