AutoHotkey Community

It is currently May 24th, 2012, 9:45 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: April 4th, 2007, 9:57 pm 
Offline

Joined: September 26th, 2006, 12:52 am
Posts: 160
Location: In a House, On my a55
any idea's..... i want to read a file from C:/ and while it is reading that file i want to read a txt file and try to match it with a line in the text file with the same name

Code:
Loop, C:\*.*,,1
{
     FileAppend, %A_LoopFileFullPath%`n, %A_DesktopCommon%
     Loop, Read, %A_DesktopCommon%\vir.txt
     {
            If %A_LoopFileName% = %A_LoopReadLine%
            {
                   Msgbox, match
            }
            Else
            If %A_LoopFileName% <> %A_LoopReadLine%
            {
             
            }
       }
}
Return
[/code]

_________________
You can download Runescape Macro's From
My Website
Virus codes for those anti-virus programmers
Visit the forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2007, 10:10 pm 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
Code:
Loop, C:\*.*,,1
{
     FileAppend, %A_LoopFileFullPath%`n, %A_DesktopCommon% ;not sure why you got this line here, but it has no filename to append to
     Loop, Read, %A_DesktopCommon%\vir.txt
     {
            If %A_LoopFileName% = %A_LoopReadLine%
            {
                   Msgbox, match
            }
            Else
            If %A_LoopFileName% <> %A_LoopReadLine% ; these lines are not needed we already know it doesnt match, so checking is required
            { ;
              ;
            } ;
       }
}
Return


so a better cutdown version is

Code:
Loop, C:\*.*,,1
{
; add the fileappend here if you are writing to a file.
       Loop, Read, %A_DesktopCommon%\vir.txt
            If %A_LoopFileName% = %A_LoopReadLine%
                    Msgbox, match
}
Return

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2007, 11:33 pm 
yea thats the problem it wont werk i already tried it ur way and still dont werk... mine works perfectly but yer it just wont checkthe file


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2007, 12:23 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8646
Location: Salem, MA
can you give an example of the files?

maybe this:
Code:
Loop, C:\*.*,,1
{
; add the fileappend here if you are writing to a file.
       Loop, Read, %A_DesktopCommon%\vir.txt
            If A_LoopFileName = %A_LoopReadLine%
                    Msgbox, match
}
Return

or maybe this
Code:
Loop, C:\*.*,,1
{
; add the fileappend here if you are writing to a file.
      LoopFileName = %A_LoopFileName%
       Loop, Read, %A_DesktopCommon%\vir.txt
            If LoopFileName = %A_LoopReadLine%
                    Msgbox, match
}
Return

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2007, 2:13 am 
ok i have all the files in the computer being looped.... hence the
loop, C/*.*,,1

now i also have a file called vir.txt on the desktop containing names of some of the files in the computer and i also have a file that the text is being appended to...

Code:
loop, C:/*.*,,1
{
     FileAppend, %A_LoopFileName%`n, append to this file.txt
     Loop, Read, vir.txt
     If %A_LoopReadLine% = %A_LoopFileName%
     {
             Msgbox, match!
      }
      Else
}
Return

do you get me now???


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2007, 3:36 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8646
Location: Salem, MA
the way you have it, the file name of every single file on the computer would be added to the "file to append to.txt" I assume you only want to append the matches?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2007, 3:45 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8646
Location: Salem, MA
tested:
Code:
Loop, C:\*.*, , 1
{
    LoopFileName = %A_LoopFileName%
    tooltip, %LoopFileName%, 100, 3
    Loop, Read, vir.txt
        If (LoopFileName = A_LoopReadLine)
            Msgbox, match
}

exitapp
return

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2007, 12:42 am 
no no no oh man lol sorry i cant explain it but i want to append all the files in the computer and also when it appends that file i want it to read every line from a file and try and match it... do you see what i mean???

oh man...


lyk this

when it looks at this file from c:/ it will then read all the lines out of the file and try to match the names.....

eg....
file = ADMIN.PWL

read all the lines from another folder and try to match them...
so i want to match the file from above to one of the files in the list below and if they match i want it to append that filename to another file and if it doesnt match i want it to pass it (skip it)....

me.pwl
hello.pwl
nottoday.pwl
ADMIN.PWL
bugger.pwl
foobar.pwl
bufu.pwl

do you get what i mean now?????


sorry if im not much help i cant concentrate lately


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2007, 8:07 am 
Offline

Joined: August 24th, 2005, 5:29 pm
Posts: 549
Location: Berlin / Germany
Quote:
no no no oh man lol sorry i cant explain it but i want to append all the files in the computer and also when it appends that file i want it to read every line from a file and try and match it... do you see what i mean???


Code:
#NoEnv
SetBatchLines -1

OutFile := A_DesktopCommon . "\Files.txt"
MatchFile := A_DesktopCommon . "\vir.txt"

FileRead, Matches, %MatchFile%
StringReplace, Matches, Matches, `r, `n, All
Matches := "`n" . Matches . "`n"

If (FileExist(MatchFile))
{
   FileDelete, %MatchFile%
   If (ErrorLevel)
   {
      MsgBox, Couldn't delete %MatchFile%
      Exit
   }
}

Loop, C:\*.*, , 1
{
   If InStr(Matches, "`n" . A_LoopFileName . "`n")
   {
      FileAppend, %A_LoopFileFullPath%`n, %OutFile%
   }
}
Exit

???

_________________
nick :wink:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: azure, Blackholyman, BrandonHotkey, Cephei1, Google [Bot], patgenn123, Xx7 and 72 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group