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 

Retrieving data from a gui edit box?

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



Joined: 24 Jan 2005
Posts: 34

PostPosted: Tue May 20, 2008 10:46 pm    Post subject: Retrieving data from a gui edit box? Reply with quote

How can I retrieve multi-line data from a gui edit box, then place a constant variable in from of each line? I am creating an inventory program to track servers in my data center. I have created a gui that stores the grid location at %grid%. You then scan all of the servers in that location and the edit box lists all of the servers as I enter them. Just like this.
    Server1
    Server2
    Server3
    Server4

I need the program to append the data to the end of a .cvs comma delimited file. Like this.
    GridLocation,Server,
    GridA1,Server1,
    GridA1,Server2,
    GridA1,Server3,
    GridA1,Server4


My constant is %grid%
Back to top
View user's profile Send private message
Extreminador



Joined: 05 May 2008
Posts: 22

PostPosted: Tue May 20, 2008 11:11 pm    Post subject: Reply with quote

Hi.

You need to use the ControlGetText.

Example using the calc.exe

Code:

ControlGetText, CalcValue, Edit1, ahk_class SciCalc
MsgBox, The value on the calc.exe edit is %CalcValue%


Good luck
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 666
Location: MN, USA

PostPosted: Wed May 21, 2008 12:10 am    Post subject: Reply with quote

Loop (parse a string)
Code:
Loop, Parse, grid, `n

_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
Hedonist



Joined: 24 Jan 2005
Posts: 34

PostPosted: Wed May 21, 2008 3:28 pm    Post subject: Reply with quote

Well first I need to be able to retrieve the data from the edit box. I keep geting "Error: The same variable cannot be used for more than one control. Specifically: vServers" for the following line of code.
Code:
Gui, 5:Add, edit, -wrap x6 y65 h121 w220 vServers,
Back to top
View user's profile Send private message
Hedonist



Joined: 24 Jan 2005
Posts: 34

PostPosted: Wed May 21, 2008 3:46 pm    Post subject: Reply with quote

Ok I dropped the "vServers" and use ControlGetText like Extreminador said. Now the code looks like this.
Code:
ControlGetText,Servers,edit1,,,,
FileAppend,
   (
   `n %grid%,%Servers%,
   ),South Inventory %timestamp%.csv


And the result is.
    Location,Server,
    gridA1,Server1
    Server2
    Server3
    Server4,


I need it to look like this.
    Location,Server,
    gridA1,Server1
    gridA1,Server2
    gridA1,Server3
    gridA1,Server4


I don't have a clue how that "Loop,Parse" works. I tried to read it over, but I am lost.
Back to top
View user's profile Send private message
Extreminador



Joined: 05 May 2008
Posts: 22

PostPosted: Wed May 21, 2008 4:20 pm    Post subject: Reply with quote

I am not sure what you want to do, but if the edit have only Server2 the only way to modify that result is after the getText you add manualy the rest.

Code:

Servers = Server1
Complete = gridA1,%Servers%
MsgBox, %Complete%
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