Jump to content

Searching...


Gaboury
 Share

Recommended Posts

Is there anyway of searching a hole harddisk for the path to a file...so if someone installs the file I need to work with within another path than the default one, I would still be able to find it...

I tried FindFileFirstFile but it just search the current directory you are in... :/ Anyone knows?

Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

This will only search the root folder of the home drive.

When searching an entire drive, speed is probably a concern and so you would do best to invoke a DOS command.

runWait(@comspec & ' /c dir /b /s file.ext > "' & @temp & '\result.txt"', @homeDrive, @SW_HIDE)

That's the easy way out as it outputs to a temporary file, which you can then read with AutoIt. If you have the beta version and would like to avoid writing to a temporary file altogether, check out the StdOutRead() function.

Link to comment
Share on other sites

runWait(@comspec & ' /c dir /b /s mirc.exe > "' & @temp & '\result.txt"', @homeDrive, @SW_HIDE)

that would serach for mirc.exe, i beleieve. correct me if im wrong.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

ok now i have a question about that lol

where does it return the value? HOW does it return the value? is there aany way to get the number of results?

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

Thanks :whistle:

Doesn't work...when it opens notepad the file is blank...

<{POST_SNAPBACK}>

you know.. Lxp is very sharp.. but i think he left out a few things this time ( and i missed it too 8)

this works

runWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\mirc.exe > "' & @TempDir & '\result.txt"', @HomeDrive, @SW_HIDE)

Run("notepad.exe " & @TempDir & "\result.txt")

8)

NEWHeader1.png

Link to comment
Share on other sites

Ye working!! And how do I make it now so it automatically changes to a ini file...could be useful :roll:

I know I am asking a lot but I am trying to learn it is only 2 days I have AutoIt and I am trying to make a Mirc Counter-Strike/Condition Zero Auto-Scrim Finder... that's why I need it to find the mirc directory :whistle:

So, is there anyway of putting this into the .ini file without a human intervention need?

Link to comment
Share on other sites

Ye working!! And how do I make it now so it automatically changes to a ini file...could be useful :roll:

I know I am asking a lot but I am trying to learn it is only 2 days I have AutoIt and I am trying to make a Mirc Counter-Strike/Condition Zero Auto-Scrim Finder...  that's why I need it to find the mirc directory :whistle:

So, is there anyway of putting this into the .ini file without a human intervention need?

<{POST_SNAPBACK}>

try on your own.... then we help

run( comspec ... bla

$file = fileopen( bla

file readline ($file)

file write ini...bla

... more code???

close file

you try... we help

8)

NEWHeader1.png

Link to comment
Share on other sites

like this... ( made a few changes @Temp was not working )

runWait(@comspec & ' /c dir /b /s mirc.exe > "' & @TempDir & '\result.txt"', '', @SW_HIDE)

Run("notepad.exe " & @TempDir & "\result.txt")

8)

<{POST_SNAPBACK}>

OK, Gaboury, since I know slightly more than you do at this point, but am still a newbie, here's what that "complicated" (yet beautiful) line of code does:

It searches your entire hard drive for the file you need and puts the result in a file called result.txt. That file ends up in your temporary directory.

And, here's how it does it:

Runwait is an AutoIT command that runs a program and waits for it to complete. Read the manual (RTM) for run v. runwait.

The /c tells the dos window to close when its done. /k would keep the window open (useful for debugging). All of the quotation marks are essential and must be used with absolute precision to avoid hours of hairpulling.

@comspec is the way that you run a dos window command from AutoIT. (Note: You can check this out by opening a dos window yourself: START>RUN>CMD+Enter. In the dos window type: dir /b /s mirc.exe Then hit Enter. The result that you see on the screen is what you will see in the result.txt file mentioned above.)

The greater than symbol ">" in the AutoIT command line means send the output of the preceding command to somewhere. In this case it will be sent to result.txt. However, for neatness, we want to make sure that file is saved into whatever temporary folder your computer uses as its default. The AutoIT Directory Macro "@TempDir" will automatically determine what that folder is and stick it's pathname in your command.

Finally, the @sw_hide at the end of the command line makes the whole thing invisible to the user. You can leave this out for debugging if you wish.

So, "runWait(@comspec & ' /c dir /b /s mirc.exe > "' & @TempDir & '\result.txt"', '', @SW_HIDE)" not only does what you want, but does it about as efficiently as possible (unlike this post). From there you can either open the result.txt file in Notepad as shown above, or you could learn about using AutoIT for opening/reading/and closing files and using stringinstr, etc. to parse for what you need, and then automating the rest of your process.

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

WoW thanks :dance:

Ooo...I've check since I posted that message and didn't find anyway to change it to a ini file :/ I tried by puttin myself the section etc on the notepad and then saving it but what if the user of my prog is german, or frenchor whatever, the winwaitactive cmd won't work so I've got no clue :whistle:

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