AutoHotkey Community

It is currently May 27th, 2012, 12:41 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: September 7th, 2005, 6:55 am 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
Code:
;<Fraction_Op.ahk>
N = 1.2 27/8

MsgBox % IsFraction(N)
F9::Reload



;----------------------------------------
;Returns 0 if not Fraction, 1 if is.
IsFraction(N)
{
   StringSplit, N, N, /
   StringSplit, S, N1, %A_Space%
   If ((S0 <> 2) Or (N0 <> 2)) Or (N0 <> 2) ; Or
      Return "0"
   If (N1 Is Not Integer) Or (N2 Is Not Integer) Or (S1 Is Not Integer)
      Return "0"
   ListVars
      Return "1"
   
}


When viewing my vars, S1 does contain "." a decimal point but still returns as 1, this makes the "documented text" untrue. This should return 0 because decimals do not make any sense in a fraction. Running Win98 se. ahk ver 1.0.36.02

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 7th, 2005, 2:19 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Although they might be supported someday, the operators "between", "is", "in", and "contains" are not supported in expressions. This is documented on the "if is" page and others.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 7th, 2005, 2:38 pm 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
I request that it be made a higher piority then, please. Such use of them would be very broad for many users.

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 7th, 2005, 3:13 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Until it gets done, you could make it a function:
Code:
IsInteger(ByRef Var)
{
    if Var is Integer
        return true
    else
        return false
}

That is how it might wind up being anyway because direct support of is/in/contains might break a few existing scripts that use these words as variables.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 32 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group