Jump to content

Search for filename


Recommended Posts

  • Moderators

$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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...