Sign in to follow this  
Followers 0
Gaboury

Searching...

42 posts in this topic

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?

Share this post


Link to post
Share on other sites



just change the current directory to @LocalDrive


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

Share this post


Link to post
Share on other sites

just change the current directory to @LocalDrive

<{POST_SNAPBACK}>

You are refering to @HomeDrive ? as @LocalDrive does not exist.

Share this post


Link to post
Share on other sites

oh yeah lol


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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Wow....that is so complicated...but example if I want to find mirc on the drive, what would I write?

Share this post


Link to post
Share on other sites

Anyone?!?

Share this post


Link to post
Share on other sites

LxP gave you the fastest way.


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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Indeed...I am a big newb...I need you guys to explain everything clearly :/ How will I get the value etc...?

Share this post


Link to post
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)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Thanks :whistle:

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

Edited by Gaboury

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

here's what that "complicated" (yet beautiful) line of code does:

<{POST_SNAPBACK}>

@jefhal

B E A U T I F U L....

8)


NEWHeader1.png

Share this post


Link to post
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:

Share this post


Link to post
Share on other sites

this is how you do it

1 run( comspec ... bla

2 $file = fileopen( bla

3 file readline ($file)

4 file write ini...bla

5 close file

you already have #1

2 look up fileopen... that is next


NEWHeader1.png

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