Gaboury Posted September 3, 2005 Share Posted September 3, 2005 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 More sharing options...
theguy0000 Posted September 3, 2005 Share Posted September 3, 2005 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 Link to comment Share on other sites More sharing options...
MHz Posted September 3, 2005 Share Posted September 3, 2005 just change the current directory to @LocalDrive<{POST_SNAPBACK}>You are refering to @HomeDrive ? as @LocalDrive does not exist. Link to comment Share on other sites More sharing options...
theguy0000 Posted September 3, 2005 Share Posted September 3, 2005 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 Link to comment Share on other sites More sharing options...
LxP Posted September 3, 2005 Share Posted September 3, 2005 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 More sharing options...
Gaboury Posted September 3, 2005 Author Share Posted September 3, 2005 Wow....that is so complicated...but example if I want to find mirc on the drive, what would I write? Link to comment Share on other sites More sharing options...
Gaboury Posted September 3, 2005 Author Share Posted September 3, 2005 Anyone?!? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2005 Moderators Share Posted September 3, 2005 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. Link to comment Share on other sites More sharing options...
theguy0000 Posted September 3, 2005 Share Posted September 3, 2005 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 More sharing options...
theguy0000 Posted September 3, 2005 Share Posted September 3, 2005 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 More sharing options...
Gaboury Posted September 3, 2005 Author Share Posted September 3, 2005 Indeed...I am a big newb...I need you guys to explain everything clearly :/ How will I get the value etc...? Link to comment Share on other sites More sharing options...
Valuater Posted September 3, 2005 Share Posted September 3, 2005 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) Link to comment Share on other sites More sharing options...
Gaboury Posted September 3, 2005 Author Share Posted September 3, 2005 (edited) Thanks Doesn't work...when it opens notepad the file is blank... Edited September 3, 2005 by Gaboury Link to comment Share on other sites More sharing options...
Valuater Posted September 3, 2005 Share Posted September 3, 2005 Thanks 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 worksrunWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\mirc.exe > "' & @TempDir & '\result.txt"', @HomeDrive, @SW_HIDE) Run("notepad.exe " & @TempDir & "\result.txt")8) Link to comment Share on other sites More sharing options...
Gaboury Posted September 3, 2005 Author Share Posted September 3, 2005 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 So, is there anyway of putting this into the .ini file without a human intervention need? Link to comment Share on other sites More sharing options...
Valuater Posted September 3, 2005 Share Posted September 3, 2005 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 So, is there anyway of putting this into the .ini file without a human intervention need?<{POST_SNAPBACK}>try on your own.... then we helprun( comspec ... bla$file = fileopen( blafile readline ($file)file write ini...bla... more code???close fileyou try... we help8) Link to comment Share on other sites More sharing options...
jefhal Posted September 3, 2005 Share Posted September 3, 2005 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 More sharing options...
Valuater Posted September 3, 2005 Share Posted September 3, 2005 here's what that "complicated" (yet beautiful) line of code does:<{POST_SNAPBACK}>@jefhalB E A U T I F U L....8) Link to comment Share on other sites More sharing options...
Gaboury Posted September 3, 2005 Author Share Posted September 3, 2005 WoW thanks 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 Link to comment Share on other sites More sharing options...
Valuater Posted September 3, 2005 Share Posted September 3, 2005 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 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