Custom Query

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (301 - 303 of 3899)

Ticket Resolution Summary Owner Reporter
#1059 Fixed Incorrect error handling in _FileListToArray() Jpm Spiff59
Description

FLTA is documented to return an @error = 4 condition when a call results in no matching files or folders. It is improperly coded and only returns the error when called in "Files and Folders" mode ($iFlag = 0). If $iFlag is set to either 1 or 2, and no matches are found, an array is incorrectly returned.

The following replacement function addresses this issue, and is on average 33% faster than the current 3.3.1.1 beta version. It is 100% compatible, and requires no modifications to the existing function header, nor to the function's helpfile entry.

This is the core logic of numerous FLTA development routines, and it has been undergoing user-testing in the field for about three months.

17-line function follows:

Func _FileListToArray2($sPath, $sFilter = "*", $iFlag = 0)
	Local $hSearch, $sFile, $sFileList, $sDelim = "|"
	$sPath = StringRegExpReplace($sPath, "[\\/]+\z", "") & "\" ; ensure single trailing backslash
	If Not FileExists($sPath) Then Return SetError(1, 1, "")
	If StringRegExp($sFilter, "[\\/:><\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "")
	If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "")
	$hSearch = FileFindFirstFile($sPath & $sFilter)
	If @error Then Return SetError(4, 4, "")
	While 1
		$sFile = FileFindNextFile($hSearch)
		If @error Then ExitLoop
		If $iFlag =  1 And @extended Then ContinueLoop ; bypass folder
		If $iFlag =  2 And @extended = 0 Then ContinueLoop ; bypass file
		$sFileList &= $sDelim & $sFile
	WEnd
	FileClose($hSearch)
	If Not $sFileList Then Return SetError(4, 4, "")
	Return StringSplit(StringTrimLeft($sFileList, 1), "|")
EndFunc;==>_FileListToArray
#1060 Fixed Run return 0, but failed Jon anonymous
Description

When I use a long argument(more than 120 char) for functions: Run, RunWait etc, ExitCode off started programm always = 0, but programm not started.

An examples (ex1-work, ex2 doesnt): ex1:

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
val = oAutoIt.RunWait("calc.exe anParamThatLessThan120Char", "C:\WINDOWS", oAutoIt.SW_MAXIMIZE)
' script waits until Notepad closes
WScript.Echo "Program returned with exit code:" & val

Result: Calc started

ex2:

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
val = oAutoIt.RunWait("calc.exe anParamThatMoreThan120CharForExample121charAndEtc_forCheckThisMakeThisStringLEnMoreThan120charsRealyMoreThan120ThankForYourSupport", "C:\WINDOWS", oAutoIt.SW_MAXIMIZE)
' script waits until Notepad closes
WScript.Echo "Program returned with exit code:" & val

Result: cals isnt started, but Msbox says that calc returns 0 as exitcode

Thanks

#1063 Fixed Documentation: _ArraySearch() example script missing a prameter Jpm PsaltyDS
Description

The 2D search example is missing a parameter in the _ArraySearch() function. Should be:

; $iIndex = _ArraySearch($avArray, $sSearch, 0, 0, 0, 1, $sColumn) ; Wrong
$iIndex = _ArraySearch($avArray, $sSearch, 0, 0, 0, 1, 1, $sColumn) ; Corrected

Still wrong in Beta 3.3.1.1 help file.

Note: See TracQuery for help on using queries.