AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Putting text into a input field

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
quatermass



Joined: 14 Dec 2005
Posts: 136

PostPosted: Fri Jun 20, 2008 8:54 pm    Post subject: Putting text into a input field Reply with quote

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.

Smile
_________________
Stuart Halliday
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Fri Jun 20, 2008 8:59 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Krogdor



Joined: 18 Apr 2008
Posts: 1145
Location: The Interwebs

PostPosted: Fri Jun 20, 2008 9:02 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
quatermass



Joined: 14 Dec 2005
Posts: 136

PostPosted: Fri Jun 20, 2008 9:43 pm    Post subject: Reply with quote

Many thanks guys. I got it working.
You're both grand!
Very Happy
_________________
Stuart Halliday
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group