Sign in to follow this  
Followers 0
vcent

How to get biggest value out of 3

7 posts in this topic

How do you write something that compare 3 or more values and find largest value

Thanks.

Share this post


Link to post
Share on other sites



ahhh actually I was reading max already. I thought I can use the same algorithm.

Actually I wanted to compare dates using FileFindFirstFile and pull out the latest date.

:)

Share this post


Link to post
Share on other sites

$search = FileFindFirstFile("*.txt")
    If $search= -1 Then Return
    Dim $file
    While 1
        $file = FileFindNextFile($search)
        If @error Then ExitLoop
                WEnd
    
    FileClose($search)

How do I put $file into an array ?

Share this post


Link to post
Share on other sites

$search = FileFindFirstFile("*.txt")
     If $search= -1 Then Return
     Dim $file
     While 1
         $file = FileFindNextFile($search)
         If @error Then ExitLoop
                 WEnd
     
     FileClose($search)

How do I put $file into an array ?

You need _FileListToArray.

Then for each file in the earray you can use FileGetTime to find the time the file was last modified, and you can use _DateDiff to see which of two dates is more recent.

To find the newest file you don't need an array at all; you can use FileFindNext as you already were and compare with the newest found so far.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

You need _FileListToArray.

Then for each file in the earray you can use FileGetTime to find the time the file was last modified, and you can use _DateDiff to see which of two dates is more recent.

To find the newest file you don't need an array at all; you can use FileFindNext as you already were and compare with the newest found so far.

That's also a good solution, perhaps more hardware friendly too (spreads out the load more)

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