AutoHotkey Community

It is currently May 27th, 2012, 1:26 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: November 20th, 2009, 3:26 am 
Offline

Joined: December 8th, 2006, 5:17 am
Posts: 248
Location: Sydney Australia
Hi

I am looping through a multi line variable and want to get user input to add two more fields. I am trying to do this through a GUI but can't seem to get the GUI refreshed for the next record. Below is the code


Code:
      Loop, parse, 3daySSP, `n, `r
         {
            If A_LoopField =
               Continue
            Gui,2: Destroy
            ThisRecord = %A_LoopField%
            APO:
            Gui,2:Add,Text, xm Section,`nPut cheque details here`n`nSERIAL - BSB - ACCT -  AMT`n%ThisRecord%`n
            Gui,2:Add,Text, xm Section,Post Office Name from APO stamp on voucher.
            Gui,2:Add,Edit, xm w420 limit50 Uppercase vPostOffice,
            Gui,2:Add,Text, xm Section , Date from APO stamp on voucher.
            Gui,2:Add,Edit, xm w420 vStampDate,
            Gui,2:Add, Button, xm wp gcreateSSPfinal, Update the APO Office and Date of processing
            Gui,2: Show, , Update the APO Office and Date of processing.
            Return
         createSSPfinal:
         Gui,2: Submit, nohide
         3daySSPfinal .= PostOffice . A_Tab . StampDate . A_Tab . ThisRecord  . "`n"
         3daySSPemail .= PostOffice . A_Tab . StampDate . A_Tab . ThisRecord  . "`%0A"
         ThisRecord =
         PostOffice =
         StampDate =
         Continue         
}


Is there a better way ( without using InputBox ) to capture the two extra fields as keyed by the users ?

Thanks in advance for any help.

_________________
Paul O


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 3:35 am 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
First of all, why are you using the second gui command, or is it just a snippit of more code? Provide us with the whole program.

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 3:48 am 
Offline

Joined: December 8th, 2006, 5:17 am
Posts: 248
Location: Sydney Australia
opps yes its part of a large piece of code. Below is a better example

Code:
3daySSP =
(
test123
test456
test789
)
      
      Loop, parse, 3daySSP, `n, `r
         {
            If A_LoopField =
               Continue
            Gui,2: Destroy
            ThisRecord = %A_LoopField%
            APO:
            Gui,Add,Text, xm Section,`nPut cheque details here`n`nSERIAL - BSB - ACCT -  AMT`n%ThisRecord%`n
            Gui,Add,Text, xm Section,Post Office Name from APO stamp on voucher.
            Gui,Add,Edit, xm w420 limit50 Uppercase vPostOffice,
            Gui,Add,Text, xm Section , Date from APO stamp on voucher.
            Gui,Add,Edit, xm w420 vStampDate,
            Gui,Add, Button, xm wp gcreateSSPfinal, Update the APO Office and Date of processing
            Gui,Show, , Update the APO Office and Date of processing. Items is %A_Index%
            Return
         createSSPfinal:
         Gui,Submit, nohide
         3daySSPfinal .= PostOffice . A_Tab . StampDate . A_Tab . ThisRecord  . "`n"
         3daySSPemail .= PostOffice . A_Tab . StampDate . A_Tab . ThisRecord  . "`%0A"
         Msgbox % 3daySSPfinal
         ThisRecord =
         PostOffice =
         StampDate =
         Continue
         }

Thanks

_________________
Paul O


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 3:58 am 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
Okay, I still don't fully understand what you're trying to do. Can you give better details of your program? What it's supposed to do? What it's not doing?

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 4:19 am 
Offline

Joined: July 18th, 2006, 12:18 pm
Posts: 403
use GuiControl to update the gui.

Here ya go
Code:
3daySSP =
(
test123
test456
test789
)

counter = 0
limiter = 1
Loop, Parse, 3daySSP, `n, `r
{
    Array%A_Index% := A_LoopField
    counter++     
}

Gui, Add,Text, xm Section vlabel1,`nPut cheque details here`n`nSERIAL - BSB - ACCT -  AMT`n%Array1%`n
Gui, Add,Text, xm Section,Post Office Name from APO stamp on voucher.
Gui, Add,Edit, xm w420 limit50 Uppercase vPostOffice,
Gui, Add,Text, xm Section , Date from APO stamp on voucher.
Gui, Add,Edit, xm w420 vStampDate,
Gui, Add, Button, xm wp gcreateSSPfinal, Update the APO Office and Date of processing
Gui, Show, , Update the APO Office and Date of processing. Items is %A_Index%
Return

createSSPfinal:
Gui,Submit, nohide
if limiter > counter ; after all the fields have been set.. show message
{
    Msgbox, 32, All fields set!
    Return
}

3daySSPfinal .= PostOffice . A_Tab . StampDate . A_Tab . ThisRecord  . "`n"
3daySSPemail .= PostOffice . A_Tab . StampDate . A_Tab . ThisRecord  . "`%0A"
Msgbox % 3daySSPfinal
ThisRecord =
PostOffice =
StampDate =

limiter++
Data := Array%limiter%
GuiControl,, label1, `nPut cheque details here`n`nSERIAL - BSB - ACCT -  AMT`n%Data%`n
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 4:32 am 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
Oh okay, I understand what you want now. Lolz, him posting that just cleared things up. XD

Well, what he said. :lol: Lolz.

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 11:34 am 
Offline

Joined: December 8th, 2006, 5:17 am
Posts: 248
Location: Sydney Australia
Thanks everyone for their help. Below is what I ended up with. Working great !

Code:
3daySSP =
(
000001 062197 11960265 1111100
123456789 262197 123456789 09 1234567890
123456789 123456 123456789 9 100
)

counter = 0
limiter = 1
Loop, Parse, 3daySSP, `n, `r
   {
    Array%A_Index% := A_LoopField
    ;msgbox % Array%A_Index%
    itemcount++     
   }
gui, font, s12
Gui, Add,Text, xm w420 Section vlabel1,`nThere are %itemcount% items left to match.`n`nSERIAL - BSB - ACCT - TC - AMT`n
Gui, Add,Text, xm cred w420 vThevalues, %Array1%`n
Gui, Add,Text, xm wp Section,Post Office Name from APO stamp on voucher.
Gui, Add,Edit, xm w420 limit50 Uppercase vPostOffice,
Gui, Add,Text, xm Section , Date from APO stamp on voucher.
Gui, Add,Edit, xm w420 vStampDate,
Gui, Add,Button, xm wp gcreateSSPfinal, Update the APO Office and Date of processing Fields
Gui, Show, , Update the APO Office and Date of processing. SSP Total is %itemcount%
Return

createSSPfinal:
Gui,Submit, nohide
limiter++
itemcount--
; set the A_LoopField values to appear in the GUI
Data4gui := Array%limiter%
; set the A_LoopField values to appear in the data file
4file := limiter-1
Data4file := Array%4file%
; update the GUI
; store the cumulative values for use later
If PostOffice =
   PostOffice = Unable to read stamp
If StampDate =
   StampDate = Unable to read stamp

3daySSPfinal .= PostOffice . A_Tab . StampDate . A_Tab . Data4file  . "`n"
3daySSPemail .= PostOffice . A_Tab . StampDate . A_Tab . Data4file  . "`%0A"
; check to see if there is any more data
; update the controls
If Data4gui !=
   {
   GuiControl,, StampDate,
   GuiControl,, PostOffice,
   GuiControl,, label1, `nThere are %itemcount% items left to match.`n`nSERIAL - BSB - ACCT - TC - AMT`n
   GuiControl,, Thevalues, %Data4gui%`n
   GuiControl, Focus, PostOffice
   }
Else
   {
   GuiControl,, StampDate,
   GuiControl,, PostOffice,
   GuiControl,, label1, `nThere are %itemcount% items left to match.`n`nSERIAL - BSB - ACCT - TC - AMT`n
   GuiControl,, Thevalues, NO MORE DATA`n
   GuiControl,Disable, StampDate,
   GuiControl,Disable, PostOffice,
   Msgbox No data left. Below is the matched input`n%3daySSPfinal%
   Gui Destroy
   }
Return

_________________
Paul O


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 2:31 pm 
Offline

Joined: July 18th, 2006, 12:18 pm
Posts: 403
no problem


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], iDrug, Ohnitiel and 26 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