vcent Posted February 21, 2009 Posted February 21, 2009 How do you write something that compare 3 or more values and find largest value Thanks.
AdmiralAlkex Posted February 21, 2009 Posted February 21, 2009 We already have that, _ArrayMax() or _ArrayMaxIndex() .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
vcent Posted February 21, 2009 Author Posted February 21, 2009 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.
vcent Posted February 21, 2009 Author Posted February 21, 2009 $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 ?
AdmiralAlkex Posted February 21, 2009 Posted February 21, 2009 _Max is only for 2 values, for more use _ArrayMax() or _ArrayMaxIndex(), it will be easier .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
martin Posted February 21, 2009 Posted February 21, 2009 $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.
AdmiralAlkex Posted February 21, 2009 Posted February 21, 2009 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) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now