 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
quatermass
Joined: 14 Dec 2005 Posts: 136
|
Posted: Fri Jun 20, 2008 8:54 pm Post subject: Putting text into a input field |
|
|
I've created a simple gui to enter some typed data.
But now I want to have a button on the window that I can click upon and the text it gets from a file and puts it into the input field before continuing.
Can someone suggest how I do this, the GUI area is new to me and looks kinda complex. I'm sure if someone can point me into the right direction I can pick it up.
| Code: | Gui, +AlwaysOnTop
Gui, Add, Text,, Enter Text
Gui, Add, Edit, Vdata w500
Gui, Add, Button, default, OK
GUI, Add, Button, X50 Y52, Paste
Gui, Show,, Fetch
return
Paste:
data:= foobar
return
|
Basically the Paste button when clicked takes data and puts in in the edit box.
 _________________ Stuart Halliday |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Fri Jun 20, 2008 8:59 pm Post subject: |
|
|
the command you are looking for is GuiControl
| Code: |
Gui, +AlwaysOnTop
Gui, Add, Text,, Enter Text
Gui, Add, Edit, Vdata w500
Gui, Add, Button, default, OK
GUI, Add, Button, X50 Y52, Paste
Gui, Show,, Fetch
return
Paste:
data:= foobar
guicontrol, , data, %data% ;the first data is the variable name associated with the edit field. the second %data% is thwe text to put in the field.
return
|
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Fri Jun 20, 2008 9:02 pm Post subject: |
|
|
First, add a gLabel to the paste button:
| Code: | | GUI, Add, Button, X50 Y52 gPaste, Paste |
This will make the label "Paste" start when the button is pressed.
Next, after defining "data", you need to make the edit control have that text:
| Code: | | guicontrol,, data, %data% |
Also, "data:= foobar" makes data equal to the contents of the variable "foobar". If you want it to contain the actual text, foobar, it should be data:="foobar" |
|
| Back to top |
|
 |
quatermass
Joined: 14 Dec 2005 Posts: 136
|
Posted: Fri Jun 20, 2008 9:43 pm Post subject: |
|
|
Many thanks guys. I got it working.
You're both grand!
 _________________ Stuart Halliday |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|