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 

Checkbox Variable Is Blank

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



Joined: 27 Jul 2008
Posts: 47
Location: England

PostPosted: Tue Mar 24, 2009 11:01 pm    Post subject: Checkbox Variable Is Blank Reply with quote

I'm making a script and it relies on whether a checkbox in a GUI window has been checked or not. The only problem is, although the variable should be 1 for checked or 0 for unchecked it is just blank! Please help!

Code:
Monthdue = 20

IniRead, Earn, Test.ini, Earn, earn
IniRead, Jancheck, Test.ini, Jancheck, check
IniRead, Febcheck, Test.ini, Febcheck, check
IniRead, Marcheck, Test.ini, Marcheck, check
IniRead, Aprcheck, Test.ini, Aprcheck, check
IniRead, Maycheck, Test.ini, Maycheck, check
IniRead, Juncheck, Test.ini, Juncheck, check
IniRead, Julcheck, Test.ini, Julcheck, check
IniRead, Augcheck, Test.ini, Augcheck, check
IniRead, Sepcheck, Test.ini, Sepcheck, check
IniRead, Octcheck, Test.ini, Octcheck, check
IniRead, Novcheck, Test.ini, Novcheck, check
IniRead, Deccheck, Test.ini, Deccheck, check

If Jancheck = N
{
Jantick =
}
If Jancheck = Y
{
Jantick = Checked
}

If Febcheck = N
{
Febtick =
}
If Febcheck = Y
{
Febtick = Checked
}

If Marcheck = N
{
Martick =
}
If Marcheck = Y
{
Martick = Checked
}

If Aprcheck = N
{
Aprtick =
}
If Aprcheck = Y
{
Aprtick = Checked
}

If Maycheck = N
{
Maytick =
}
If Maycheck = Y
{
Maytick = Checked
}

If Juncheck = N
{
Juntick =
}
If Juncheck = Y
{
Juntick = Checked
}

If Julcheck = N
{
Jultick =
}
If Julcheck = Y
{
Jultick = Checked
}

If Augcheck = N
{
Augtick =
}
If Augcheck = Y
{
Augtick = Checked
}

If Sepcheck = N
{
Septick =
}
If Sepcheck = Y
{
Septick = Checked
}

If Octcheck = N
{
Octtick =
}
If Octcheck = Y
{
Octtick = Checked
}

If Novcheck = N
{
Novtick =
}
If Novcheck = Y
{
Novtick = Checked
}

If Deccheck = N
{
Dectick =
}
If Deccheck = Y
{
Dectick = Checked
}

Gui, Add, Text, x5 y5, Months:
Gui, Add, Text, x5 y+10, January
Gui, Add, Text, x5 y+2, Febuary
Gui, Add, Text, x5 y+2, March
Gui, Add, Text, x5 y+2, April
Gui, Add, Text, x5 y+2, May
Gui, Add, Text, x5 y+2, June
Gui, Add, Text, x5 y+2, July
Gui, Add, Text, x5 y+2, August
Gui, Add, Text, x5 y+2, September
Gui, Add, Text, x5 y+2, October
Gui, Add, Text, x5 y+2, November
Gui, Add, Text, x5 y+2, December

Gui, Add, Text, x85 y5, Amount Due:
Gui, Add, Text, x85 y+10, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%
Gui, Add, Text, x85 y+2, £%Earn%

Gui, Add, Text, x165 y5, Recieved:
Gui, Add, Checkbox, x165 y+10 %Jantick% vJanBox,
Gui, Add, Checkbox, x165 y+2 %Febtick% vFebBox,
Gui, Add, Checkbox, x165 y+2 %Martick% vMarBox,
Gui, Add, Checkbox, x165 y+2 %Aprtick% vAprBox,
Gui, Add, Checkbox, x165 y+2 %Maytick% vMayBox,
Gui, Add, Checkbox, x165 y+2 %Juntick% vJunBox,
Gui, Add, Checkbox, x165 y+2 %Jultick% vJulBox,
Gui, Add, Checkbox, x165 y+2 %Augtick% vAugBox,
Gui, Add, Checkbox, x165 y+2 %Septick% vSepBox,
Gui, Add, Checkbox, x165 y+2 %Octtick% vOctBox,
Gui, Add, Checkbox, x165 y+2 %Novtick% vNovBox,
Gui, Add, Checkbox, x165 y+2 %Dectick% vDecBox,
Gui, Add, Button, x5 y+2 w200 h20 Default, Update
Gui, Show,, Title For GUI,
Return,

ButtonUpdate:

If JanBox = 1
{
MsgBox, Ticked
}
If Jancheck = 0
{
MsgBox, Not Ticked
}

Return,


Note, this script relies on an INI file. That part of it is working perfectly (I think). If you want the INI file its source is:
Code:
****************************************************************
*     EARN CHECK                                               *
****************************************************************
[Earn]
Earn=20

****************************************************************
*     MONTH / WEEK CHECK                                       *
****************************************************************
[Monthorweek]
Check=Mon

****************************************************************
*     CHECK BOX CHECK                                          *
****************************************************************
[Jancheck]
Check=Y
[Febcheck]
Check=Y
[Marcheck]
Check=Y
[Aprcheck]
Check=N
[Maycheck]
Check=N
[Juncheck]
Check=N
[Julcheck]
Check=N
[Augcheck]
Check=N
[Sepcheck]
Check=N
[Octcheck]
Check=N
[Novcheck]
Check=N
[Deccheck]
Check=N

This should be placed in the same directory as the script.

Thanks in advance!
Robbo
_________________
All scripts are untested unless otherwise mentioned.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
sinkfaze



Joined: 18 Mar 2008
Posts: 5043
Location: the tunnel(?=light)

PostPosted: Tue Mar 24, 2009 11:30 pm    Post subject: Reply with quote

This perhaps?

Code:
ButtonUpdate:

Gui, Submit, NoHide

If JanBox = 1
{
MsgBox, Ticked
}
If Jancheck = 0
{
MsgBox, Not Ticked
}

Return,

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
Robbo



Joined: 27 Jul 2008
Posts: 47
Location: England

PostPosted: Tue Mar 24, 2009 11:34 pm    Post subject: Reply with quote

God I must be slow tonight Rolling Eyes ! Of course! (I'm not usually that stupid.)

Thanks!
_________________
All scripts are untested unless otherwise mentioned.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
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