dufran3 Posted November 3, 2006 Share Posted November 3, 2006 Sorry, it's me again. Freak I suck, I've been asking questions up the yazoo...sorry guys. I have learned tons though!!!! I am starting to wrap my head around array's! which to me...are very very scary! I really appreciate all your help, as you have helped me tremendously, I am now starting to check the forums to help others... However, I am trying to search the "C:\Documents and Settings\" folder for a file containing the word "Star". It is a shortcut, and could be in several users profiles including the all users and default user profile. I was hoping to find a way to search the directory and sub directories and maybe return the results in an array or something. Anyway, I decided I will try to be more helpful, and post some of my creations. I was able to write this type of thing searching the registry, here is the script for that if anyone ever needs something like it.. My first publicly posted script....please don't murder me...I'm new... ; ; Function SearchDestroyReg ($searchpath, $valuename, $searchstring) ; $searchpath is the registy path to search under ; $searchstring is the content of the "DisplayName" value you are looking for (ie "Dell Crap 5.2") ; $valuename is the value you are searching in (ie "DisplayName" or "UninstallString") ; ; When $searchstring is found in $valuename, then the entire reg key is deleted. ; Func SearchDestroyReg($searchpath, $valuename, $searchstring) For $i= 1 to 10000 $currentkey = RegEnumKey($searchpath, $i) If @error <> 0 then ExitLoop $displayname = RegRead($searchpath & "\" & $currentkey, $valuename) if $displayname == $searchstring Then RegDelete($searchpath & "\" & $currentkey) EndIf Next EndFunc ;-------This would delete the key "Quicktime" ;Example ;SearchDestroyReg("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\", "DisplayName", "QuickTime") ;Example Link to comment Share on other sites More sharing options...
Uten Posted November 4, 2006 Share Posted November 4, 2006 Take a look at #include <File.au3> _FileListToArray($sPath [, $sFilter [, $iFlag]])In the help file. And if you want to learn somthing take a look at the source Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 4, 2006 Moderators Share Posted November 4, 2006 Maybe these 2 links could help.http://www.autoitscript.com/forum/index.ph...st&p=261201http://www.autoitscript.com/forum/index.ph...c=33930&hl= 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...
dufran3 Posted November 6, 2006 Author Share Posted November 6, 2006 Take a look at CODE: AutoIt #include <File.au3> _FileListToArray($sPath [, $sFilter [, $iFlag]]) In the help file. And if you want to learn somthing take a look at the source smile.gif That looks like it only searches the specified directory and not sub directories under it. Maybe these 2 links could help. http://www.autoitscript.com/forum/index.ph...st&p=261201 http://www.autoitscript.com/forum/index.ph...c=33930&hl= This looks like a complicated UDF. I looked through it, looking up the functions and Macros that were used. It requires a file extension ie. ".exe" or ".txt" to search for, and I'm not searching for a specific file extension...well, I guess I am, I am looking for a shortcut so, it would be .lnk, that contains the word "star" in it. Not sure if I can use that UDF for what I am trying to do. Link to comment Share on other sites More sharing options...
Uten Posted November 6, 2006 Share Posted November 6, 2006 run(@comspec & " dir /B /S *star*lnk > out.dat") Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
dufran3 Posted November 6, 2006 Author Share Posted November 6, 2006 I tried running this, however it never created that out.dat file, so I assume it is not finding any results. Here are a couple of things I have done. I can successfully open up the command prompt, and type the following commands. C: -changes current directory to C: cd documents and settings - changes to documents and settings folder dir /b /s *star* > C:\out.txt -this ouputs all of my search results to the txt file. here is the autoit that I am trying to get to work, that doesn't seem to be working. _RunDOS("C:" & @CRLF & "cd documents and settings" & @CRLF &"dir /b /s *star* > C:\out.txt") oÝ÷ Ø¥²kçm+ºØv'gßÛp¢¹Ø^«¢+Ø)}IÕ¹=L Ìäí¥ÈÅÕ½ÐíèÀäÈí½Õµ¹Ñ̹ÍÑÑ¥¹ÌÅÕ½Ð콽̩ÍÑȨÐíèÀäÈí½ÕйÑáÐÌäì¤( Which doesn't seems to work either... Link to comment Share on other sites More sharing options...
Uten Posted November 6, 2006 Share Posted November 6, 2006 What happens if you use *.* in that code? Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Uten Posted November 6, 2006 Share Posted November 6, 2006 I would recoment using Run rather than _RunDOS. And make shure to set the workingpath Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] ) run(@comspec & " /C dir /B /S *star*lnk > c:\out.dat", @ProgramsDir, @SW_SHOW) Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
dufran3 Posted November 6, 2006 Author Share Posted November 6, 2006 You pwn me! THX 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