Jump to content
Sign in to follow this  
anixon

@Hour

Recommended Posts

anixon

I have resolved this issue but listing it here to establish whether or not it should be resolved

-contents of ini file-

[section1]

Value=6

-Process-

$Hour = IniRead($ScriptDirM, "Section1", "value","")

If @Hour = $Hour then

;Do something

Endif

This process fails because the value in the ini file 6 does not equal the hour value which has the value 06 at 6am.

If you change the ini file value to 06 then the process works.

It has been noted that greater than or less than or equal to or not equal to all work indicating that 06 is being processed as a number rather than a string.

My puzzle is that 06 in the absence of a decimal point should be the value 6 so with an ini file value of 6 why did not not work?

Ant..

Share this post


Link to post
Share on other sites
monoceres

Force autoit to compare them as numbers:

$hour="6"
If Int(@hour)=Int($hour) Then MsgBox(0,"Blabla","Blaaa")

:P

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
anixon

Force autoit to compare them as numbers:

$hour="6"
If Int(@hour)=Int($hour) Then MsgBox(0,"Blabla","Blaaa")

:P

Thanks for that so Int makes it a whole number which as you say forces it to be seen as a number. Which leads to the question what would you use to force a number to be compared as text as can be the case in Excel for example ? Ant..

Share this post


Link to post
Share on other sites
monoceres

Thanks for that so Int makes it a whole number which as you say forces it to be seen as a number. Which leads to the question what would you use to force a number to be compared as text as can be the case in Excel for example ? Ant..

Unimaginable enough the function is called String() :P


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
anixon

Unimaginable enough the function is called String() :P

Fantastic so much to learn. On a funny note and with string as the theme my son [he's 12] keeps asking me, Dad how long is a piece of string()? to which the answer is always 50% of its length when folded in half or if you find that hard to believe its 1/16 of its length when folded in four. Which simply proves that many answers are sometimes unremarkable. Ant.. :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.