 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
edu
Joined: 12 Oct 2006 Posts: 99 Location: Canada
|
Posted: Thu Jul 17, 2008 5:28 pm Post subject: how to retrieve the edit boxes's contents from a gui |
|
|
Hello, forum!
I'm really sorry for asking this basic question, but I really can't find a solution:
I have this code:
| Code: |
Gui, Font, S11 CDefault, Verdana
Gui, Add, Text,, How many boxes for this shipment?
Gui, Add, Edit, vBoxes, 1 ; Input the number of boxes
Gui, Add, ComboBox, vTipo , Door-to-Station||Door-to-Door ; service type
Gui, Add, Button, default, OK
Gui, Show, , Shipments
return
ButtonOK:
Gui, Submit,
Loop %Boxes%
{
Gui, 2: Add, edit, vpack%A_index% ; creates as many edit boxes as you specified
}
Gui, 2: Add, Button, default, OK
Gui 2: Show, , Boxes (Weight in Pounds)
Return
2ButtonOK:
Gui, Submit,
GuiClose:
ExitApp
|
Now what i'd like to do is to take all the values of the boxes in the second Gui and append them to a text file -- from pack1 to pack3, or 4 or however many -- each in a different line
From then on, I think I can figure out. _________________ The best things of life are free. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jul 17, 2008 6:59 pm Post subject: |
|
|
it's not that different with ButtonOK:
| Code: | 2ButtonOK:
Gui, Submit,
Loop, %Boxes%
MsgBox % pack%A_Index%
Return |
|
|
| Back to top |
|
 |
edu
Joined: 12 Oct 2006 Posts: 99 Location: Canada
|
Posted: Thu Jul 17, 2008 8:32 pm Post subject: |
|
|
Thanks for your help, but my problem is that this syntax doesn't work with FileAppend
| Code: | | FileAppend, pack%A_Index%, results.txt |
Would give me pack1, pack2, pack2..., instead of the values like 5, 10, 12, etc.
Edu _________________ The best things of life are free. |
|
| Back to top |
|
 |
ribbs2521
Joined: 28 Sep 2007 Posts: 273 Location: New York
|
Posted: Thu Jul 17, 2008 8:40 pm Post subject: |
|
|
I may be wrong but it looks like your context is wrong if your FileAppend command. I think you need % pack%%A_Index% and that will only work if FileAppend is in the Loop because A_Index will only change if that is true.
The way your context is would result in your file saying something like "pack1pack2pack3etc...." because it is reading pack as a literal string so you need the % pack%%A_Index% as the guest showed in his code. Then it will write the actual contents of the variables %pack1% etc.
Note: Also if you want a , after each number I think you would need to use something like this or use a different delimiter:
| Code: | | FileAppend, % pack%%A_Index%`,, Results.txt |
|
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1390 Location: The Interwebs
|
Posted: Thu Jul 17, 2008 8:55 pm Post subject: |
|
|
| ribbs2521 wrote: | | Code: | | FileAppend, % pack%%A_Index%`,, Results.txt |
|
Should be | Code: | | FileAppend, % pack%A_Index% "`," , Results.txt |
You had too many % signs, plus a literal string ( `, ) in an expression without double quotes. |
|
| Back to top |
|
 |
ribbs2521
Joined: 28 Sep 2007 Posts: 273 Location: New York
|
Posted: Thu Jul 17, 2008 9:40 pm Post subject: |
|
|
| Thanks for fixing that. |
|
| Back to top |
|
 |
Edu_guest Guest
|
Posted: Thu Jul 17, 2008 11:15 pm Post subject: |
|
|
Thanks, that really works now!
Eduardo |
|
| 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
|