Jump to content

Expression problem


Recommended Posts

$var1 = 100

$var2 = 10

;$var1 = IniRead($LogFile, "Schijf defragmenteren", "Defrag", "Niets gevonden")

;$var2 = IniRead($MyDeDir & "Analyze.ini" ,"Analyze " & "d:", "Fragmented N", "Niet gevonden")

If $var2 > $var1 Then

MsgBox(0, "yes",$var2 & " > " & $var1,2)

Else

MsgBox(0, "no",$var2 & " > " & $var1,2)

EndIf

$var = StringCompare ( $var2 , $var1 )

If $var > 0 Then

MsgBox(0, "yes", $var2 & " > " & $var1,2)

Else

MsgBox(0, "no", $var2 & " > " & $var1,2)

EndIf

Why works this perfect, but when the $var comes from IniRead it's not working.

By the "If <expression> Then statement" its the second $var.

Of course I want to do it with the IniRead variables.

Link to comment
Share on other sites

  • Developers

Try:

$var1 = Number(IniRead($LogFile, "Schijf defragmenteren", "Defrag", "Niets gevonden"))

Mvg

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

If i remember correctly IniRead returns strings. There have been numerous discussions on this forum on this subject. The best way I think is to convert the strings returned from iniread to numbers using int or number.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

If i remember correctly IniRead returns strings. There have been numerous discussions on this forum on this subject. The best way I think is to convert the strings returned from iniread to numbers using int or number.

If the discussions have been sooo numerous, wouldn't it be a nice idea to improve the iniread function, for example in the way I suggested here ?? :)

Has enhancement suggestion for autoit, I think that iniread should return a variable type in the same kind of the default value.

iniread(file,section,variable,0) should return an integer

iniread(file,section,variable,"0") should return a string

iniread(file,section,variable,False) should return a boolean

Link to comment
Share on other sites

You don't have to but some users alter the title of the topic prepending "[sOVLED]"

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Developers

Oke, thnks

edit: can't edit topic page.

Don't worry... It will get down the list when people give up adding posts to it... :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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