Jump to content

Recommended Posts

Posted

I tried searching for it in the forum, but couldn't find anything that was of use. Are there any search for filename udf's or searching for keywords in filenames? If not, any idea how I could go about making this?

  • Moderators
Posted

$returncode = _FileSearch(@HomeDrive & '\*.au3')
If IsArray($returncode) Then
    For $i = 0 To UBound($returncode) - 1
        MsgBox(64, 'info', $returncode[$i])
    Next
EndIf

Func _FileSearch($s_Mask = '', $i_Recurse = 1)
    Local $s_Command = ' /c dir /B "'
    If $i_Recurse = 1 Then $s_Command = ' /c dir /B /S "'
    Local $s_Buf = '', $i_Pid = Run(@ComSpec & $s_Command & $s_Mask & '"', @WorkingDir, @SW_HIDE, 2+4)
    ProcessSetPriority($i_Pid, 5)
    While Not @error
        $s_Buf &= StdoutRead($i_Pid)
    WEnd
    $s_Buf = StringSplit(StringTrimRight($s_Buf, 2), @CRLF, 1)
    ProcessClose($i_Pid)
    If UBound($s_Buf) = 2 AND $s_Buf[1] = '' Then SetError(1)
    Return $s_Buf
EndFunc  ;==>_FileSearch

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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
×
×
  • Create New...