Jump to content

Search function?


Recommended Posts

hi,

how do I scan for a file in system drive and append the path file to a text file or append it to a variable?

I can do it AutoIT 2 but I couldn't figure out how to do it AutoIT3 :lmao: but in AutoIT 2 I still have to use batch command to search and append it to a Text file and then using AutoIT 2 to read each line if there are more than one path.

please help

Many thanks

Link to comment
Share on other sites

if you can do it in v2 what is the need to rewrite it in v3?

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

hi,

how do I scan for a file in system drive and append the path file to a text file or append it to a variable?

I can do it AutoIT 2 but I couldn't figure out how to do it AutoIT3 :lmao: but in AutoIT 2 I still have to use batch command to search and append it to a Text file and then using AutoIT 2 to read each line if there are more than one path.

please help

Many thanks

<{POST_SNAPBACK}>

Tip: You could to start with the Au2 -> Au3 Converter
Link to comment
Share on other sites

What about

Do
   $filename = InputBox("Search","What is the filename?")
   If @error  = 1 then Exit
Until Not $filename = ""
RunWait(@ComSpec & " /c " & "dir C:\ /s > C:\Temp\dir.txt")
$file = FileOpen("C:\temp\dir.txt",0)
If @error = -1 then 
   MsgBox(0,"Error","File Open Error")
   Exit
EndIf
While 1
   $line = FileReadLine($file)
   If @error = -1 then 
      $bailout = 1
      ExitLoop; EOF
   EndIf
   If Not StringInString($line,$filename) = "" Then
      MsgBox(0,"Found It",$line)
      ExitLoop
   Endif
   Sleep(10)
Wend

If $bailout = 1 then MsgBox(0,"Error","File Not Found")

*** Untested code written off the cuff.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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