| View previous topic :: View next topic |
| Author |
Message |
Loriss
Joined: 26 Jul 2004 Posts: 64
|
Posted: Wed Dec 12, 2007 3:27 pm Post subject: Problem If + and |
|
|
I have H. version 10.47.05 and i have problem whit if + and .
var=20071210
if var <= %A_YYYY%%A_MM%%A_DD%
msgbox, ok
it's Ok, it matck
if A_HOUR <= 24
msgbox, ok
it's Ok, it matck
if(var <= %A_YYYY%%A_MM%%A_DD% and A_HOUR<=24)
msgbox, ok
this do not matck !
My problem is this , because in this way is not working ? _________________ Loriss |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1186 Location: switzerland
|
Posted: Wed Dec 12, 2007 4:09 pm Post subject: |
|
|
var:=20071210 ;for digit
| Code: | var=%A_YYYY%%A_MM%%A_DD%
var1:=20071210
var2:=var ;now
if var1 <= var2
msgbox, ok1
else
msgbox,not ok1
if A_HOUR <= 16
msgbox, ok2
else
msgbox,not ok2
if (var1 <=var2 and A_HOUR <=18)
msgbox,ok3
else
msgbox,not ok3
|
Last edited by garry on Wed Dec 12, 2007 4:26 pm; edited 1 time in total |
|
| Back to top |
|
 |
Loriss
Joined: 26 Jul 2004 Posts: 64
|
Posted: Wed Dec 12, 2007 4:15 pm Post subject: |
|
|
Even whit
var:=20071210
if(var <= %A_YYYY%%A_MM%%A_DD% and A_HOUR<=24)
msgbox, ok
Do not matck ! ! _________________ Loriss |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1186 Location: switzerland
|
Posted: Wed Dec 12, 2007 4:33 pm Post subject: |
|
|
| hello loriss, I've continued above, finished the script |
|
| Back to top |
|
 |
dmatch
Joined: 15 Oct 2007 Posts: 113
|
Posted: Wed Dec 12, 2007 4:41 pm Post subject: |
|
|
It does not give the "expected" results because %A_YYYY%%A_MM%%A_DD% is seen as a variable name when the expression version if() is used. Today this would be the variable 20071212 which is not assigned any value so it is always less than Var. Take off the () and it should work as expected.
| Code: | var=20071210
if var <= %A_YYYY%%A_MM%%A_DD%
msgbox, ok1
if A_HOUR <= 24
msgbox, ok2
if var <= %A_YYYY%%A_MM%%A_DD% and A_HOUR<=24
msgbox, ok3 |
dmatch
Last edited by dmatch on Wed Dec 12, 2007 4:43 pm; edited 1 time in total |
|
| Back to top |
|
 |
Loriss
Joined: 26 Jul 2004 Posts: 64
|
Posted: Wed Dec 12, 2007 4:42 pm Post subject: |
|
|
ok ,
but for my if this not matck
var:=20071210
if(A_HOUR<=24 and var <=%A_YYYY%%A_MM%%A_DD%)
msgbox, ok
if not matck , there is a bug ........ _________________ Loriss |
|
| Back to top |
|
 |
dmatch
Joined: 15 Oct 2007 Posts: 113
|
Posted: Wed Dec 12, 2007 4:48 pm Post subject: |
|
|
You can see what I mean with the following, which will work for today only:
| Code: |
var=20071210
20071212=99999999
if(var <= %A_YYYY%%A_MM%%A_DD% and A_HOUR<=24)
msgbox, ok
|
dmatch |
|
| Back to top |
|
 |
Loriss
Joined: 26 Jul 2004 Posts: 64
|
Posted: Wed Dec 12, 2007 4:51 pm Post subject: |
|
|
even whit,
var:=20071210
vartoday=%A_YYYY%%A_MM%%A_DD%
if(A_HOUR<=24 and var <=%vartoday%)
msgbox, pippo
do not matck .
Wihtout () , in not possible matck if + and . _________________ Loriss |
|
| Back to top |
|
 |
Loriss
Joined: 26 Jul 2004 Posts: 64
|
Posted: Wed Dec 12, 2007 4:59 pm Post subject: |
|
|
| Loriss wrote: | even whit,
var:=20071210
vartoday=%A_YYYY%%A_MM%%A_DD%
if(A_HOUR<=24 and var <=%vartoday%)
msgbox, ok
do not matck .
Without () , is not possible matck if + and . |
_________________ Loriss
Last edited by Loriss on Wed Dec 12, 2007 5:01 pm; edited 1 time in total |
|
| Back to top |
|
 |
dmatch
Joined: 15 Oct 2007 Posts: 113
|
Posted: Wed Dec 12, 2007 5:01 pm Post subject: |
|
|
You don't need the % around vartoday. The variable names are used without percent when using the if() expression version... unless you want to refer to a dynamic variable using %name% (the variiable whose name is contained in name).
| Code: | var=20071210
vartoday=%A_YYYY%%A_MM%%A_DD%
if(A_HOUR<=24 and var <= vartoday)
msgbox, pippo |
This definitely CAN be confusing.
dmatch
Last edited by dmatch on Wed Dec 12, 2007 5:08 pm; edited 1 time in total |
|
| Back to top |
|
 |
Loriss
Joined: 26 Jul 2004 Posts: 64
|
Posted: Wed Dec 12, 2007 5:05 pm Post subject: |
|
|
OK , now is Good !
TankYou. _________________ Loriss |
|
| Back to top |
|
 |
dmatch
Joined: 15 Oct 2007 Posts: 113
|
Posted: Wed Dec 12, 2007 5:07 pm Post subject: You're Welcome |
|
|
You are Welcome.
dmatch |
|
| Back to top |
|
 |
|