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 

Problem If + and

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



Joined: 26 Jul 2004
Posts: 64

PostPosted: Wed Dec 12, 2007 3:27 pm    Post subject: Problem If + and Reply with quote

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
View user's profile Send private message AIM Address
garry



Joined: 19 Apr 2005
Posts: 1186
Location: switzerland

PostPosted: Wed Dec 12, 2007 4:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
Loriss



Joined: 26 Jul 2004
Posts: 64

PostPosted: Wed Dec 12, 2007 4:15 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
garry



Joined: 19 Apr 2005
Posts: 1186
Location: switzerland

PostPosted: Wed Dec 12, 2007 4:33 pm    Post subject: Reply with quote

hello loriss, I've continued above, finished the script
Back to top
View user's profile Send private message
dmatch



Joined: 15 Oct 2007
Posts: 113

PostPosted: Wed Dec 12, 2007 4:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
Loriss



Joined: 26 Jul 2004
Posts: 64

PostPosted: Wed Dec 12, 2007 4:42 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
dmatch



Joined: 15 Oct 2007
Posts: 113

PostPosted: Wed Dec 12, 2007 4:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Loriss



Joined: 26 Jul 2004
Posts: 64

PostPosted: Wed Dec 12, 2007 4:51 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Loriss



Joined: 26 Jul 2004
Posts: 64

PostPosted: Wed Dec 12, 2007 4:59 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
dmatch



Joined: 15 Oct 2007
Posts: 113

PostPosted: Wed Dec 12, 2007 5:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Loriss



Joined: 26 Jul 2004
Posts: 64

PostPosted: Wed Dec 12, 2007 5:05 pm    Post subject: Reply with quote

OK , now is Good !

TankYou.
_________________
Loriss
Back to top
View user's profile Send private message AIM Address
dmatch



Joined: 15 Oct 2007
Posts: 113

PostPosted: Wed Dec 12, 2007 5:07 pm    Post subject: You're Welcome Reply with quote

You are Welcome.

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