Jump to content

@Hour


Recommended Posts

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..

Link to comment
Share on other sites

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..
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...