bobheart Posted May 29, 2004 Share Posted May 29, 2004 How would i do a input box so i can pick what I want to search for ? DirCreate("C:\list1") Run(@comspec& " /c dir *.dll /s >c:\list1\dlllist.txt","c:\",@SW_HIDE) This works good now but i will have to make a bunch and would be nice to just say search for jpg's or dll's etc. Link to comment Share on other sites More sharing options...
Josbe Posted May 29, 2004 Share Posted May 29, 2004 Do you want a input many times asking for extension? (Use a loop) Or display two extensions in a list? Run(@ComSpec & ' /c dir *.dll *.jpg /s > c:\list1\mylist.txt', 'c:\', @SW_HIDE) AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
bobheart Posted May 29, 2004 Author Share Posted May 29, 2004 (edited) well just one time asking what extension would be fine I think . Then If I need it again just run it again .all rename the txt file before i run it again. lol Unless you can input what to save the txt file as ? Edited May 29, 2004 by bobheart Link to comment Share on other sites More sharing options...
bobheart Posted May 29, 2004 Author Share Posted May 29, 2004 what do you say josbe ? or anyone how do I do this . Link to comment Share on other sites More sharing options...
SlimShady Posted May 29, 2004 Share Posted May 29, 2004 (edited) Here it is: DirCreate("C:\list1") $Extension = InputBox("List Files","Please enter the extension of the files you want to list." & @CRLF & _ "(Without a dot)", "", "", 350, -1) Run(@comspec& " /c dir *." & $Extension & " /s >c:\list1\dlllist.txt","c:\",@SW_HIDE) Edited May 29, 2004 by SlimShady Link to comment Share on other sites More sharing options...
bobheart Posted May 29, 2004 Author Share Posted May 29, 2004 (edited) Can you kind of tell me how you added the part where they can input what they want to search so Maybe can do it my self ? Thank you btw .. Edited May 29, 2004 by bobheart Link to comment Share on other sites More sharing options...
SlimShady Posted May 29, 2004 Share Posted May 29, 2004 I commented the script. Here it is: DirCreate("C:\list1"); <------- Create Directory ; The 2 lines below are for the inputbox. What the user enters is saved as $Extension $Extension = InputBox("List Files","Please enter the extension of the files you want to list." & @CRLF & _ "(Without a dot)", "", "", 350, -1) ;This line below runs a command with the user input: $Extension Run(@comspec& " /c dir *." & $Extension & " /s >c:\list1\dlllist.txt","c:\",@SW_HIDE) Link to comment Share on other sites More sharing options...
bobheart Posted May 29, 2004 Author Share Posted May 29, 2004 Thank you that helps a lot . Link to comment Share on other sites More sharing options...
SlimShady Posted May 29, 2004 Share Posted May 29, 2004 Thank you that helps a lot .You're welcome. Link to comment Share on other sites More sharing options...
bobheart Posted May 29, 2004 Author Share Posted May 29, 2004 Well what the hell ? Trying the same code on my D: drive and it won't do anything ? DirCreate("C:\list1") $Extension = InputBox("List Files","Please enter the extension of the files you want to list." & @CRLF & _ "(Without a dot)", "txt", "", 350, -1) Run(@comspec& " /D dir *." & $Extension & " /s >c:\list1\list.txt","D:\",@SW_HIDE) what did I do wrong this time ? Link to comment Share on other sites More sharing options...
Developers Jos Posted May 29, 2004 Developers Share Posted May 29, 2004 Run(@comspec& " /C dir D:\*." & $Extension & " /s >c:\list1\list.txt","D:\",@SW_HIDE) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
bobheart Posted May 29, 2004 Author Share Posted May 29, 2004 So you have to have the /C first then . ummm would that not make it search c ? strange how some of this is . Link to comment Share on other sites More sharing options...
Developers Jos Posted May 29, 2004 Developers Share Posted May 29, 2004 /C is part of cmd or command and the command behind it is run... in this case Dir d:\*.* CMD [/A | /U][/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] [ [/C | /K] string] /C Carries out the command specified by string and then terminates /K Carries out the command specified by string but remains /S Modifies the treatment of string after /C or /K (see below) /Q Turns echo off /D Disable execution of AutoRun commands from registry (see below) /A Causes the output of internal commands to a pipe or file to be ANSI /U Causes the output of internal commands to a pipe or file to be Unicode /T:fg Sets the foreground/background colors (see COLOR /? for more info) /E:ON Enable command extensions (see below) /E:OFF Disable command extensions (see below) /F:ON Enable file and directory name completion characters (see below) /F:OFF Disable file and directory name completion characters (see below) /V:ON Enable delayed environment variable expansion using ! as the delimiter. For example, /V:ON would allow !var! to expand the variable var at execution time. The var syntax expands variables at input time, which is quite a different thing when inside of a FOR SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
tutor2000 Posted May 29, 2004 Share Posted May 29, 2004 (edited) How would i do a input box so i can pick what I want to search for ? DirCreate("C:\list1") Run(@comspec& " /c dir *.dll /s >c:\list1\dlllist.txt","c:\",@SW_HIDE) This works good now but i will have to make a bunch and would be nice to just say search for jpg's or dll's etc.Larry did a function for a recursive filefindnext function Should be faster than compiling a list. You could use a loop to change the suffix or search string Rick Found it ; _FileSearch( <Path and Mask>, <Option (0 - normal, 1- recursive)>) ; Returns array. Either Array of files (full path) where... ; Array[0] is number of files. ; Array[0] = 0 if nothing found. ; ; EXAMPLE USAGE ;-------------------------------------------- $a = _FileSearch("*.au3",1) If $a[0] > 0 Then For $i = 1 to $a[0] MsgBox(4096,"",$a[$i]) Next EndIf ;-------------------------------------------- Func _FileSearch($szMask,$nOption) $szRoot = "" $hFile = 0 $szBuffer = "" $szReturn = "" $szPathList = "*" Dim $aNULL[1] If Not StringInStr($szMask,"\") Then $szRoot = @SCRIPTDIR & "\" Else While StringInStr($szMask,"\") $szRoot = $szRoot & StringLeft($szMask,StringInStr($szMask,"\")) $szMask = StringTrimLeft($szMask,StringInStr($szMask,"\")) Wend EndIf If $nOption = 0 Then _FileSearchUtil($szRoot, $szMask, $szReturn) Else While 1 $hFile = FileFindFirstFile($szRoot & "*.*") If $hFile >= 0 Then $szBuffer = FileFindNextFile($hFile) While Not @ERROR If $szBuffer <> "." And $szBuffer <> ".." And _ StringInStr(FileGetAttrib($szRoot & $szBuffer),"D") Then _ $szPathList = $szPathList & $szRoot & $szBuffer & "*" $szBuffer = FileFindNextFile($hFile) Wend FileClose($hFile) EndIf _FileSearchUtil($szRoot, $szMask, $szReturn) If $szPathList == "*" Then ExitLoop $szPathList = StringTrimLeft($szPathList,1) $szRoot = StringLeft($szPathList,StringInStr($szPathList,"*")-1) & "\" $szPathList = StringTrimLeft($szPathList,StringInStr($szPathList,"*")-1) Wend EndIf If $szReturn = "" Then $aNULL[0] = 0 Return $aNULL[0] Else Return StringSplit(StringTrimRight($szReturn,1),"*") EndIf EndFunc Func _FileSearchUtil(ByRef $ROOT, ByRef $MASK, ByRef $RETURN) $hFile = FileFindFirstFile($ROOT & $MASK) If $hFile >= 0 Then $szBuffer = FileFindNextFile($hFile) While Not @ERROR If $szBuffer <> "." And $szBuffer <> ".." Then _ $RETURN = $RETURN & $ROOT & $szBuffer & "*" $szBuffer = FileFindNextFile($hFile) Wend FileClose($hFile) EndIf EndFunc Edited May 29, 2004 by tutor2000 Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm Link to comment Share on other sites More sharing options...
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