AutoHotkey Community

It is currently May 26th, 2012, 9:15 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: July 17th, 2008, 6:28 pm 
Offline

Joined: October 12th, 2006, 9:57 pm
Posts: 99
Location: Canada
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2008, 7:59 pm 
it's not that different with ButtonOK:

Code:
2ButtonOK:
Gui, Submit,
Loop, %Boxes%
    MsgBox % pack%A_Index%
Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2008, 9:32 pm 
Offline

Joined: October 12th, 2006, 9:57 pm
Posts: 99
Location: Canada
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2008, 9:40 pm 
Offline

Joined: September 28th, 2007, 3:56 am
Posts: 279
Location: New York
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2008, 9:55 pm 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2008, 10:40 pm 
Offline

Joined: September 28th, 2007, 3:56 am
Posts: 279
Location: New York
Thanks for fixing that.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2008, 12:15 am 
Thanks, that really works now!

Eduardo


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, fusion1920, MSN [Bot], poserpro, tomoe_uehara and 60 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group