Multiline input
Multiline input
Hi,
How do I make the InputBox, UserInput multiline?
Thank you!
How do I make the InputBox, UserInput multiline?
Thank you!
Re: Multiline input
You can create a custom GUI with an Edit control as the input field. Here is a customizable InputBox you could use directly, but it doesn't have to be that complicated.
Re: Multiline input
Try this:
Code: Select all
MsgBox, % InputBoxML("Enter your address:", "Address", 3)
return
InputBoxML(prompt="", title="", rows=2, width=200) {
static IbmlEntry
Gui, IBML:+ToolWindow +hwndIbmlID
Gui, IBML:Add, Text,, % prompt
Gui, IBML:Add, Edit, % "vIbmlEntry xm r" rows " w" width
Gui, IBML:Add, Button, % "gIbmlSubmit xm+" width/2-25 " w50", Submit
Gui, IBML:Show,, % title
WinWaitClose, ahk_id %IbmlID%
Gui, IBML:Destroy
return IbmlEntry
IbmlSubmit:
Gui, IBML:Submit
return
}
Re: Multiline input
Can you please make it FileAppend to a text file with a OK and Cancel button.
The submitted text should be entered in a text file with current=.
Thank you for your help!
The submitted text should be entered in a text file with current=.
Thank you for your help!
Re: Multiline input
So you weren’t really just stuck on the multi-line InputBox question? You just wanted someone to write your script? You can take it from here.
Re: Multiline input
I have InputBox setup that writes to a text file.
I am not sure how to use multiline input write to a text file.
Thank you!
I am not sure how to use multiline input write to a text file.
Thank you!
Re: Multiline input
OK. Here’s how you do that. I also added the Cancel button:
Code: Select all
Address := InputBoxML("Enter your address:", "Address", 3)
if (Address != "")
FileAppend, % Address, MyFile.txt
return
InputBoxML(prompt="", title="", rows=2, width=200) {
static IbmlEntry
Gui, IBML:+ToolWindow +hwndIbmlID
Gui, IBML:Add, Text,, % prompt
Gui, IBML:Add, Edit, % "vIbmlEntry xm r" rows " w" width
Gui, IBML:Add, Button, % "gIbmlOK xm+" width/2-65 " w50", OK
Gui, IBML:Add, Button, gIbmlCancel x+30 w50, Cancel
Gui, IBML:Show,, % title
WinWaitClose, ahk_id %IbmlID%
Gui, IBML:Destroy
return OK ? IbmlEntry : ""
IbmlOK:
OK := 1
Gui, IBML:Submit
return
IbmlCancel:
OK := 0
Gui, IBML:Cancel
return
}
Re: Multiline input
Thank you very much for your help!!
Re: Multiline input
Can you please tell me how to write to a text file under C:\Program Files\Folder\File.txt
Due to permissions it's not writing to a file under C:\Program Files folder.
Thank you!
Due to permissions it's not writing to a file under C:\Program Files folder.
Thank you!
Re: Multiline input
I would just not write to a file in that folder. Why does it have to be there? It's very likely that it doesn't.
Re: Multiline input
I am using an application that only allows to store .txt files in that folder.
Thank you!
Thank you!
Re: Multiline input
Hi,
How can I use Esc key to close the GUI window.
Thank you!
How can I use Esc key to close the GUI window.
Thank you!
Re: Multiline input
Code: Select all
Esc::Gui, Cancel
Re: Multiline input
Can you please tell me where to add this, thank you!
Re: Multiline input
You can put it at the very bottom of the script.
Re: Multiline input
The following is not working:
Code: Select all
Address := InputBoxML("Enter your address:", "Address", 3)
if (Address != "")
FileAppend, % Address, MyFile.txt
return
InputBoxML(prompt="", title="", rows=2, width=200) {
static IbmlEntry
Gui, IBML:+ToolWindow +hwndIbmlID
Gui, IBML:Add, Text,, % prompt
Gui, IBML:Add, Edit, % "vIbmlEntry xm r" rows " w" width
Gui, IBML:Add, Button, % "gIbmlOK xm+" width/2-65 " w50", OK
Gui, IBML:Add, Button, gIbmlCancel x+30 w50, Cancel
Gui, IBML:Show,, % title
WinWaitClose, ahk_id %IbmlID%
Gui, IBML:Destroy
return OK ? IbmlEntry : ""
IbmlOK:
OK := 1
Gui, IBML:Submit
return
IbmlCancel:
OK := 0
Gui, IBML:Cancel
return
Esc::Gui, Cancel
}
Re: Multiline input
I said to put that line at the very bottom, not inside a function. Also, it will need the GUI label:
Code: Select all
Esc::Gui, IBML:Cancel
Re: Multiline input
Now Esc is not working for regular InputBox.
It works without Esc::Gui, IBML:Cancel being added.
Thank you!
It works without Esc::Gui, IBML:Cancel being added.
Thank you!
Re: Multiline input
I have this InputBox as well https://www.autohotkey.com/docs/v1/lib/InputBox.htm