Sign in to follow this  
Followers 0
Softieware

Expression problem

10 posts in this topic

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Try:

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

Mvg

Jos

Great!

"It's the little things you must now."

Bedankt,

mvg

Wijbe

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

This problem is solved.

Must I close the topic and how can I do this?

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Oke, thnks

edit: can't edit topic page.

Edited by Softieware

Share this post


Link to post
Share on other sites

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

I know but it is good to give a (the right) solution en let other people let know that.....

Mvg.

Wijbe

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  
Followers 0