Grantgimp 0 Posted August 22, 2010 In an attempt to automatically open the most recent file, I came across lots of examples in the forum, but none of them did exactly what I needed, so I played around with them until it worked and here is the code - #Include <File.au3> #Include <Array.au3> #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> #include <Process.au3> $dst = "C:\Documents and Settings\user\My Documents" ;specify folder $a_FileList = _FileListToArray2() _ArraySort($a_FileList, 1, 1, $a_FileList[0][0], 1) ShellExecute($a_FileList[1][0]) Func _FileListToArray2($s_Mask='*') $h_Search = FileFindFirstFile($dst & '\' & $s_Mask) $s_FileName = FileFindNextFile($h_Search) If Not @error Then Dim $a_File[100][2] While Not @error if StringInStr($s_FileName,'.',0,-1) Then $s_FullName = $dst & '\' & $s_FileName $a_File[0][0] += 1 If $a_File[0][0] >= UBound($a_File) Then ReDim $a_File[$a_File[0][0] * 2][2] EndIf $a_File[$a_File[0][0]][0] = FileGetLongName($s_FullName) $a_File[$a_File[0][0]][1] = FileGetTime($s_FullName,0,1) EndIf $s_FileName = FileFindNextFile($h_Search) WEnd ReDim $a_File[$a_File[0][0] + 1][2] Return $a_File Else Return '' EndIf EndFunc Hope someone finds it useful. Share this post Link to post Share on other sites
wakillon 403 Posted September 2, 2010 It can be usefull Thanks AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites