Sign in to follow this  
Followers 0
bobheart

Not sure if this can be done as I don't know how

14 posts in this topic

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.

Share this post


Link to post
Share on other sites



Do you want a input many times asking for extension? :D

(Use a loop)

Or display two extensions in a list?

Run(@ComSpec & ' /c dir *.dll *.jpg /s > c:\list1\mylist.txt', 'c:\', @SW_HIDE)

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by bobheart

Share this post


Link to post
Share on other sites

what do you say josbe ? or anyone how do I do this .

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by SlimShady

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by bobheart

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

Thank you that helps a lot .

Share this post


Link to post
Share on other sites

Thank you that helps a lot .

You're welcome.

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

So you have to have the /C first then . ummm

would that not make it search c ? strange how some of this is .

Share this post


Link to post
Share on other sites

/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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#14 ·  Posted (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 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

Share this post


Link to post
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
Sign in to follow this  
Followers 0