Jump to content

Search


Recommended Posts

Hey, kinda newbie here. I am trying to create a script that will search your computer for files. I havent taken the time to make ;comments yet. I'm trying to find out how to to use FileFindNextFile to search subfolders for files. If there is another command I need to use I'm listening.

Also If I can make the script simpler, tell me :geek:

#include <GUIConstants.au3>

FileInstall("C:\Documents and Settings\wmerkel\Desktop\Programming\FindIt.ico", @TempDir)

GUICreate("FindIt!", 313, 161, 348, 272)
$search_title = GUICtrlCreateInput("Whatever", 8, 16, 233, 21, -1, $WS_EX_CLIENTEDGE)
$FindIt = GUICtrlCreateButton("Find It", 256, 8, 40, 40, BitOR($BS_DEFPUSHBUTTON,$BS_ICON))
$dir_mydocs = GUICtrlCreateRadio("My Documents", 16, 72, 97, 17)
$dir_all = GUICtrlCreateRadio("Entire System", 16, 88, 89, 17)
$dir_user = GUICtrlCreateRadio("Custom Directory", 16, 104, 105, 17)
$cust_path = GUICtrlCreateInput("None", 16, 128, 193, 21, $ES_READONLY, $WS_EX_CLIENTEDGE)
$browse_button = GUICtrlCreateButton("...", 210, 128, 25, 21)

GUICtrlCreateGroup("Path", 8, 56, 289, 97)
GUISetIcon(@TempDir & "\Findit.ico")
GUICtrlSetImage($FindIt, @TempDir & "\Findit.ico")

GUICtrlSetState($browse_button, $GUI_DISABLE)
GUICtrlSetState($dir_mydocs, $GUI_CHECKED)
GUICtrlSetState($cust_path, $GUI_DISABLE)
GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $FindIt
        Call("Search")
    Case $msg = $browse_button
        Call("Browse")
    Case $msg = $dir_user
        GUICtrlSetState($cust_path, $GUI_ENABLE)
        GUICtrlSetState($browse_button, $GUI_ENABLE)
    Case $msg = $dir_all
        GUICtrlSetState($cust_path, $GUI_DISABLE)
        GUICtrlSetState($browse_button, $GUI_DISABLE)
    Case $msg = $dir_mydocs
        GUICtrlSetState($cust_path, $GUI_DISABLE)
        GUICtrlSetState($browse_button, $GUI_DISABLE)
    EndSelect
WEnd
Exit
Func Browse()
    $cust_path_select = FileSelectFolder("Custom Folder","C:\") & "\"
    GUICtrlSetData($cust_path, $cust_path_select)
EndFunc
Func Search()
    GUICtrlRead($browse_button)
    GUICtrlRead($cust_path)
    GUICtrlRead($dir_all)
    GUICtrlRead($dir_mydocs)
    GUICtrlRead($dir_user)
    GUICtrlRead($search_title)
    
    
    
    GUICreate("SearchIt!", 297, 92, 352, 253)
    $scan_prog = GUICtrlCreateProgress(8, 32, 273, 25)
    $scan_cancel = GUICtrlCreateButton("Cancel", 112, 64, 57, 24)
    
    GUISetIcon("C:\Documents and Settings\wmerkel\Desktop\Programming\SearchIt!\FindIt.ico")
    GUICtrlSetColor($scan_prog, 0x00FFFF)
    GUICtrlCreateLabel("Searching For", 32, 8, 70, 17)
    GUISetState(@SW_SHOW)
    
    $scan_prog_num = -1
    
    FileFindFirstFile
    
    $msg = GuiGetMsg()
    While 1
        Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $scan_cancel
            ExitLoop
        Case $msg = $msg
            $scan_prog_num = $scan_prog_num + 1
            GUICtrlSetData($scan_prog, $scan_prog_num)
            FileFindNextFile
        EndSelect
    WEnd
    Exit
EndFunc

:o

Link to comment
Share on other sites

  • Moderators

Valauter has made a few of these... They are in scripts and scraps... take a peak, should help you out on your own project... or since it's made, you might just want to use his.

Here's one here: http://www.autoitscript.com/forum/index.ph...59&hl=Valuater#

Edited by SmOke_N

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

Valauter has made a few of these... They are in scripts and scraps... take a peak, should help you out on your own project... or since it's made, you might just want to use his.

Here's one here: http://www.autoitscript.com/forum/index.ph...59&hl=Valuater#

there are a few recursive scripts for file listing (like mine) etc... someone will probably tell you that the fastest and easiest way would be to use a 'dir /s filename.ext' from command line, and parse the output...
Link to comment
Share on other sites

there are a few recursive scripts for file listing (like mine) etc... someone will probably tell you that the fastest and easiest way would be to use a 'dir /s filename.ext' from command line, and parse the output...

that actual command line ... and FileListtoArray

are both in my search engines

8)

NEWHeader1.png

Link to comment
Share on other sites

  • Moderators

"Beta Run" wont work

But i have an idea

If someone could tell how i could transfer data from .ahk to .au3 scripts withouut it being Oh So Obvious.

Registry? :o

What does that mean? Translate .ahk to .au3?

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

  • Moderators

You could use an .ini file and condition statements... Maybe if they have console write you could use StderrRead/StdOutRead/StdOutWrite... Personally, I know nothing of them, and or how their script works... the syntax I've seen seems like the ancient AutoIt v2 version :o (wonder why), but I still have never even downloaded their program.

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