How to get input from msgbox and use as variables in code?

Get help with using AutoHotkey and its commands and hotkeys
omar
Posts: 462
Joined: 22 Oct 2015, 17:56

How to get input from msgbox and use as variables in code?

23 Jan 2021, 21:02

I've never done this before...
But, I want to have a msgbox popup that asks for 3 inputs say.
I then want to execute simple code using this 3 variables?

I'm guessing this is simple

Can someone show me code to start me off?

Thanks
BoBo
Posts: 4362
Joined: 13 May 2014, 17:15

Re: How to get input from msgbox and use as variables in code?

23 Jan 2021, 21:10

You can ...
a) create a single :arrow: InputBox that asks for three (delimiter separated) items
b) create 3 consecutively appearing InputBoxes
c) create a custom made Gui holding three edit fields.

Code: Select all

InputBox, var , Title, Enter 3 comma separated values!
v := StrSplit(var,",")
MsgBox % v.1
MsgBox % v.2
MsgBox % v.3
omar
Posts: 462
Joined: 22 Oct 2015, 17:56

Re: How to get input from msgbox and use as variables in code?

28 Jan 2021, 19:04

@BoBo Thanks 👍🏼
The solution you gave will do perfectly for now
The other 2 I assume are a bit more complicated?
BoBo
Posts: 4362
Joined: 13 May 2014, 17:15

Re: How to get input from msgbox and use as variables in code?

28 Jan 2021, 19:35

Not necessarily ...

Code: Select all

InputBox, v1 , Title, Enter value one!
InputBox, v2 , Title, Enter value two!
InputBox, v3 , Title, Enter value three!
MsgBox % v1
MsgBox % v2
MsgBox % v3

Code: Select all

Gui, -Caption +Border 
Gui, Add, Edit, vE1 y8 w130,% "<Enter a value>"
Gui, Add, Edit, vE2 wp,% "<Enter a value>"
Gui, Add, Edit, vE3 wp,% "<Enter a value>"
Gui, Add, Button, gButton,% "OK"
Gui, Show, w150,% chr(32)
Return

Button:
Gui, Submit, Destroy ; NoHide
MsgBox % E1 "`n" E2 "`n" E3
Return

GuiClose:
GuiEscape:
ExitApp
Concept.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], genericindividual69, MatthewMirage, mikeyww, Nixcalo, roysubs, XMCQCX and 56 guests