 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Jeremiah
Joined: 20 Apr 2009 Posts: 797 Location: North Dakota, USA
|
Posted: Tue Mar 09, 2010 10:04 pm Post subject: Duplicate variable error |
|
|
Hey everyone. I am getting an annoying duplicate variable error when there is not a duplicate variable. Can anyone help me out with this?
| Code: | SetTimer, CBN, 50
MsgBox, 4131, New Request, Which request would you like to fill out?
CBN:
IfWinNotExist, New Request
Return
ControlSetText, Button1, &VOICE
ControlSetText, Button2, &PLS
IfMsgBox, Yes ; VOICE
REQUEST = VOICE
IfMsgBox, No ; PLS
REQUEST = PLS
Gui, Font, w700
Gui, Add, GroupBox, x11 y4 w280 h180 , Customer
Gui, Font, w400
Gui, Add, Text, x21 y24 w40 h20 , Name
Gui, Add, Edit, x21 y44 w260 h20 vCNAME,
Gui, Add, Text, x21 y74 w110 h20 , Account Number
Gui, Add, Edit, x21 y94 w260 h20 vCNUM, 2
Gui, Add, Text, x21 y124 w80 h20 , Product Line
Gui, Add, DropDownList, x21 y144 w150 h10 vPRODLN, 3
Gui, Add, Text, x181 y124 w50 h20 , Version
Gui, Add, DropDownList, x181 y144 w100 h20 vVERS, 4
Gui, Font, w700
Gui, Add, GroupBox, x11 y194 w280 h180 , Partner
Gui, Font, w400
Gui, Add, Text, x21 y214 w40 h20 , Name
Gui, Add, Edit, x21 y234 w260 h20 vPNAME, 5
Gui, Add, Text, x21 y264 w110 h20 , Account Number
Gui, Add, Edit, x21 y284 w260 h20 vPNUM, 6
Gui, Add, Text, x21 y314 w60 h20 , Location
Gui, Add, Edit, x21 y334 w260 h20 vLOC, 7
Gui, Font, w700
Gui, Add, GroupBox, x301 y4 w280 h180 , VSA
Gui, Font, w400
Gui, Add, Text, x311 y24 w160 h20 , Service Request Number
Gui, Add, Edit, x311 y44 w260 h20 vSRNUM, 8
Gui, Add, Text, x311 y74 w100 h20 , Order Number
Gui, Add, Edit, x311 y94 w260 h20 vORDNUM, 9
Gui, Add, Text, x311 y124 w80 h20 , Order Total
Gui, Add, Edit, x311 y144 w260 h20 vORDTOT, 10
Gui, Font, w700
Gui, Add, GroupBox, x301 y194 w280 h180 , Steps
Gui, Font, w400
Gui, Add, Text, x311 y214 w260 h20 , Steps taken to research the inquiry/order:
Gui, Add, Edit, x311 y234 w260 h50 vSTEPS, 11
Gui, Add, Text, x311 y294 w260 h20 , Detailed description of the issue:
Gui, Add, Edit, x311 y314 w260 h50 vDESC, 12
Gui, Add, Button, x21 y384 w100 h30 , 13
Gui, Add, Button, x171 y384 w100 h30 , 14
Gui, Add, Button, x321 y384 w100 h30 , 15
Gui, Add, Button, x471 y384 w100 h30 , Submit
Gui, Show, w598 h428, VOICE/PLS Request
Return
GuiClose:
ExitApp |
The issue seems to be isolated to the timer up top to change the button names. When I take that part out, it works perfect. What's going on here? I have tried to change my variable name (CNAME) to something else, but this does not do it. I have also tried to change the "ControlSetText" line to change buttons "Yes" and "No" instead of "Button1(2)." I am so frustrated with troubleshooting it, I had to post it all up. Sorry for the length, and thank you for any replies. _________________ -Jeremiah |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 09, 2010 10:08 pm Post subject: Re: Duplicate variable error |
|
|
You are falling into the same "trying to re-create the Gui every time" problem that many users have had...
You need to build the Gui once, then show/hide & use GuiControl to change things about it...
Move all the Gui, Add's above the CBN label & try to make it work that way...this is a common error/mistake, I need to find or create a concrete example of it & how to get past it... |
|
| Back to top |
|
 |
Eedis
Joined: 12 Jun 2009 Posts: 1158 Location: Indianapolis IN, USA
|
Posted: Tue Mar 09, 2010 10:12 pm Post subject: |
|
|
| Code: | SetTimer, CBN, 50
MsgBox, 4131, New Request, Which request would you like to fill out?
Gui, Font, w700
Gui, Add, GroupBox, x11 y4 w280 h180 , Customer
Gui, Font, w400
Gui, Add, Text, x21 y24 w40 h20 , Name
Gui, Add, Edit, x21 y44 w260 h20 vCNAME,
Gui, Add, Text, x21 y74 w110 h20 , Account Number
Gui, Add, Edit, x21 y94 w260 h20 vCNUM, 2
Gui, Add, Text, x21 y124 w80 h20 , Product Line
Gui, Add, DropDownList, x21 y144 w150 h10 vPRODLN, 3
Gui, Add, Text, x181 y124 w50 h20 , Version
Gui, Add, DropDownList, x181 y144 w100 h20 vVERS, 4
Gui, Font, w700
Gui, Add, GroupBox, x11 y194 w280 h180 , Partner
Gui, Font, w400
Gui, Add, Text, x21 y214 w40 h20 , Name
Gui, Add, Edit, x21 y234 w260 h20 vPNAME, 5
Gui, Add, Text, x21 y264 w110 h20 , Account Number
Gui, Add, Edit, x21 y284 w260 h20 vPNUM, 6
Gui, Add, Text, x21 y314 w60 h20 , Location
Gui, Add, Edit, x21 y334 w260 h20 vLOC, 7
Gui, Font, w700
Gui, Add, GroupBox, x301 y4 w280 h180 , VSA
Gui, Font, w400
Gui, Add, Text, x311 y24 w160 h20 , Service Request Number
Gui, Add, Edit, x311 y44 w260 h20 vSRNUM, 8
Gui, Add, Text, x311 y74 w100 h20 , Order Number
Gui, Add, Edit, x311 y94 w260 h20 vORDNUM, 9
Gui, Add, Text, x311 y124 w80 h20 , Order Total
Gui, Add, Edit, x311 y144 w260 h20 vORDTOT, 10
Gui, Font, w700
Gui, Add, GroupBox, x301 y194 w280 h180 , Steps
Gui, Font, w400
Gui, Add, Text, x311 y214 w260 h20 , Steps taken to research the inquiry/order:
Gui, Add, Edit, x311 y234 w260 h50 vSTEPS, 11
Gui, Add, Text, x311 y294 w260 h20 , Detailed description of the issue:
Gui, Add, Edit, x311 y314 w260 h50 vDESC, 12
Gui, Add, Button, x21 y384 w100 h30 , 13
Gui, Add, Button, x171 y384 w100 h30 , 14
Gui, Add, Button, x321 y384 w100 h30 , 15
Gui, Add, Button, x471 y384 w100 h30 , Submit
Gui, Show, w598 h428, VOICE/PLS Request
CBN:
IfWinNotExist, New Request
Return
ControlSetText, Button1, &VOICE
ControlSetText, Button2, &PLS
IfMsgBox, Yes ; VOICE
REQUEST = VOICE
IfMsgBox, No ; PLS
REQUEST = PLS
Return
GuiClose:
ExitApp |
_________________ www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
 |
|
| Back to top |
|
 |
Jeremiah
Joined: 20 Apr 2009 Posts: 797 Location: North Dakota, USA
|
Posted: Tue Mar 09, 2010 10:15 pm Post subject: Re: Duplicate variable error |
|
|
| Anonymous wrote: | You are falling into the same "trying to re-create the Gui every time" problem that many users have had...
You need to build the Gui once, then show/hide & use GuiControl to change things about it...
Move all the Gui, Add's above the CBN label & try to make it work that way...this is a common error/mistake, I need to find or create a concrete example of it & how to get past it... |
-Guest
Firstly, thank you for your reply. I'm not sure I understand why this is happening. Aren't I just building the gui once the way it was?
-Eedis
Thank you. _________________ -Jeremiah |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 09, 2010 10:19 pm Post subject: Re: Duplicate variable error |
|
|
| Jeremiah wrote: | | Aren't I just building the gui once the way it was? |
...no, the CBN timer was hitting all the Gui, Add's before...
Wait...the CBN timer is only to change the msgbox?...change that to "SetTimer, CBN, -50"...negative means to run only once...currently it's constantly changing the msgbox's button names to what they already are... |
|
| Back to top |
|
 |
Jeremiah
Joined: 20 Apr 2009 Posts: 797 Location: North Dakota, USA
|
Posted: Tue Mar 09, 2010 10:24 pm Post subject: |
|
|
That worked great! Both methods worked great. I don't really have much experience with the Timers, I just copied and pasted the example that was in the documentation. I'm still confused about how a timer works for this, but hey... it works. Thanks guys! _________________ -Jeremiah |
|
| 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
|