 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Tue May 20, 2008 10:46 pm Post subject: Retrieving data from a gui edit box? |
|
|
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 |
|
 |
Extreminador
Joined: 05 May 2008 Posts: 22
|
Posted: Tue May 20, 2008 11:11 pm Post subject: |
|
|
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 |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 666 Location: MN, USA
|
|
| Back to top |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Wed May 21, 2008 3:28 pm Post subject: |
|
|
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 |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Wed May 21, 2008 3:46 pm Post subject: |
|
|
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 |
|
 |
Extreminador
Joined: 05 May 2008 Posts: 22
|
Posted: Wed May 21, 2008 4:20 pm Post subject: |
|
|
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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|