 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Seclinix
Joined: 26 Sep 2006 Posts: 175 Location: In a House, On my a55
|
Posted: Wed Apr 04, 2007 9:57 pm Post subject: Reading C:\ and file the same time |
|
|
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 |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 853 Location: London, UK
|
Posted: Wed Apr 04, 2007 10:10 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
seclinix - offline Guest
|
Posted: Wed Apr 04, 2007 11:33 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu Apr 05, 2007 12:23 am Post subject: |
|
|
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
|
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
seclinix - offline Guest
|
Posted: Thu Apr 05, 2007 2:13 am Post subject: |
|
|
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??? |
|
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu Apr 05, 2007 3:36 am Post subject: |
|
|
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? _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu Apr 05, 2007 3:45 am Post subject: |
|
|
tested:
| Code: |
Loop, C:\*.*, , 1
{
LoopFileName = %A_LoopFileName%
tooltip, %LoopFileName%, 100, 3
Loop, Read, vir.txt
If (LoopFileName = A_LoopReadLine)
Msgbox, match
}
exitapp
return
|
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
seclinix - offline Guest
|
Posted: Sat Apr 07, 2007 12:42 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
nick
Joined: 24 Aug 2005 Posts: 345 Location: Berlin / Germany
|
Posted: Sat Apr 07, 2007 8:07 am Post subject: |
|
|
| 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
denick @ http://de.autohotkey.com/forum/ |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|