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 

Loop, rebuild GUI for further user input

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



Joined: 08 Dec 2006
Posts: 248
Location: Sydney Australia

PostPosted: Fri Nov 20, 2009 2:26 am    Post subject: Loop, rebuild GUI for further user input Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Eedis



Joined: 12 Jun 2009
Posts: 1158
Location: Indianapolis IN, USA

PostPosted: Fri Nov 20, 2009 2:35 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
poo_noo



Joined: 08 Dec 2006
Posts: 248
Location: Sydney Australia

PostPosted: Fri Nov 20, 2009 2:48 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Eedis



Joined: 12 Jun 2009
Posts: 1158
Location: Indianapolis IN, USA

PostPosted: Fri Nov 20, 2009 2:58 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
i3egohan



Joined: 18 Jul 2006
Posts: 403

PostPosted: Fri Nov 20, 2009 3:19 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Eedis



Joined: 12 Jun 2009
Posts: 1158
Location: Indianapolis IN, USA

PostPosted: Fri Nov 20, 2009 3:32 am    Post subject: Reply with quote

Oh okay, I understand what you want now. Lolz, him posting that just cleared things up. XD

Well, what he said. Laughing Lolz.
_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
poo_noo



Joined: 08 Dec 2006
Posts: 248
Location: Sydney Australia

PostPosted: Fri Nov 20, 2009 10:34 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
i3egohan



Joined: 18 Jul 2006
Posts: 403

PostPosted: Fri Nov 20, 2009 1:31 pm    Post subject: Reply with quote

no problem
Back to top
View user's profile Send private message
Display posts from previous:   
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