Page 3 of 4 <1234>
Topic Options
#167807 - 2006-09-20 01:15 AM Re: Need some help
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Change this
Code:

While @Error = 0
$2 = Split($R,CHR(9))
If InStr($2[1],$Date)
$Nul = Open(2,'C:\TEMP\Compile.TXT',5)
While @Error = 0
$Nul = Writeline(2,$R+@crlf)
$R Readline(1)
Loop
EndIf
$R = Readline(1)
Loop


To this
Code:

$Nul = Open(2,'C:\TEMP\Compile.TXT',5)
While @Error = 0
$Nul = Writeline(2,$R+@crlf)
$R Readline(1)
Next
Code:






Top
#167808 - 2006-09-20 01:18 AM Re: Need some help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
While - Loop, not Next
Top
#167809 - 2006-09-20 01:37 AM Re: Need some help
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Code:

$R=Readline(1)


Top
#167810 - 2006-09-20 01:50 AM Re: Need some help
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Cut and paste - My bad
Top
#167811 - 2006-09-20 02:27 AM Re: Need some help
Tony72 Offline
Getting the hang of it

Registered: 2002-06-18
Posts: 53
Gargoyle:

I've never gotten your script to run. It sits there for about 15 minutes, then usually errors out, and never even creates an output text file (this last time I got a "undefined variable [Nul]!" error.

I'm assuming it ran out of log files... but it has never generated any output text file. Does it have to finish running before it will write an output file?

Top
#167812 - 2006-09-20 03:05 AM Re: Need some help
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
It should create the file right off.

You may want to run it in debug mode so that you can see exactly where it is having an issue.

As for the $Nul, that is because it was added after the fact, and it is not Dimmed, and the explicit option is turned on.

Top
#167813 - 2006-09-20 04:00 AM Re: Need some help
Tony72 Offline
Getting the hang of it

Registered: 2002-06-18
Posts: 53
Actually, the one NTDoc has above I managed to get working after inserting a few pieces of site-specific info: it goes into each user's directory and the text file gets written.

Could someone just recommend what to change in that one so it will either take all the entries for a specified month, or else just grab everything? Which ever is fastest and easiest at this point: the people waiting on this are getting very impatient that it's not done.

My problem, I know, but aaaaaaaaaargh. It sucks knowing I once knew how to do this, and can't remember at all. I must have lost several points of int somewhere... and didn't have any to spare in the first place.

Top
#167814 - 2006-09-20 04:48 AM Re: Need some help
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
You can alway's just take the output from DirPlus and concanate the files into one.

Copy $File1+$File2+$File3 OutputFile.txt

Top
#167815 - 2006-09-20 11:46 PM Re: Need some help
Tony72 Offline
Getting the hang of it

Registered: 2002-06-18
Posts: 53
Is there any way to handle it like a DOS
Code:

type logfile.txt>>c:\temp\compile



For some reason I remember the DOS stuff, but KiXtart has faded away

Top
#167816 - 2006-09-20 11:49 PM Re: Need some help
Tony72 Offline
Getting the hang of it

Registered: 2002-06-18
Posts: 53
Wow... did I just answer my own question?

I'll test it out... I might be able to do a
Code:
SHELL "CMD.EXE type logfile.txt>>C:\temp\compile.txt"



Wish me luck.

Top
#167817 - 2006-09-21 01:52 AM Re: Need some help
Tony72 Offline
Getting the hang of it

Registered: 2002-06-18
Posts: 53
Damn, it isnt working. For some reason, it will type the log file, but it isnt piping it into compile.txt
Top
#167818 - 2006-09-21 02:15 AM Re: Need some help
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Code:

for each $file in dirplus('X:\Office\Type','/s1 /a-d /m logfile.txt')
Shell "Copy c:\temp\compile.txt + " + $File " c:\temp\compile.txt"
next



This is untested, but may do the job of concatanting all the files together.

Top
#167819 - 2006-09-21 02:44 AM Re: Need some help
Tony72 Offline
Getting the hang of it

Registered: 2002-06-18
Posts: 53
Is this for your script or NTDOC's? Where would I insert this (and what would I replace)?
Top
#167820 - 2006-09-21 02:52 AM Re: Need some help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11602
Loc: CA
Tony,

Okay, so lets copy all the files into a single file.
Are you sure that's what you want?
I don't see how you're going to know who's data is whos that way.

I'll make a code change that will work just fine and post it in a minute, but really think that is not going to work for you.

What version of KiXtart did you say you're using?

Top
#167821 - 2006-09-21 03:10 AM Re: Need some help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
SHELL "%comspec% /c type logfile.txt >>C:\temp\compile.txt"
Top
#167822 - 2006-09-21 03:16 AM Re: Need some help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11602
Loc: CA
Okay here you go. This will copy all the logfile.txt files into a single file (you need to modify your locations, etc..)

Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Dim $Path, $Dest, $File, $Files, $Folder, $Folders
$Path = 'C:\Office\Type'
$File = 'logfile.txt'
$Dest = 'C:\TEMP\AllUserLogFiles.txt'
If Exist($Dest)
Del $Dest
EndIf
$Folders = DirL($Path)
For Each $Folder In $Folders
If $Folder
If Exist($Path+'\'+$Folder+'\'+$File)
$Files = $Files + '+' + $Path+'\'+$Folder+'\'+$File
EndIf
EndIf
Next
SHELL '%Comspec% /c COPY ' + Right($Files,-1) + ' ' + $Dest + ' >nul 2>nul '
'File copy status: ' + @ERROR + ' - ' + @SERROR ?


Function DirL($f)
Dim $a[0]
$f = Dir($f)
While Not @ERROR
If $f <> '..' And $f <> '.'
$a[UBound($a)] = $f
ReDim Preserve $a[UBound($a)+1]
EndIf
$f = Dir()
Loop
If UBound($a)
ReDim Preserve $a[UBound($a)-1]
Else
$a = 0
EndIf
$DirL = $a
EndFunction

Top
#167823 - 2006-09-21 03:18 AM Re: Need some help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11602
Loc: CA
Hmmm just thinking of this method though. If you had hundreds of files it would not work as the command line would be too long.

Though slow I think you may have to do the redirect of each file into a single file.

Top
#167824 - 2006-09-21 03:20 AM Re: Need some help
Tony72 Offline
Getting the hang of it

Registered: 2002-06-18
Posts: 53
I'm using the 2010.452.

Having it all in one file is fine: I'll just sort it with Excel. If I sort everything by the date column, I can remove everything not in the month I want. Then I remove certain other details, and I'm done.
_________________________
Be kind; each person is fighting his own private war.

Top
#167825 - 2006-09-21 03:22 AM Re: Need some help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11602
Loc: CA
Okay, this method should work regardless
of the amount of files you need to process.

Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Dim $Path, $Dest, $File, $Files, $Folder, $Folders
$Path = 'C:\Office\Type'
$File = 'logfile.txt'
$Dest = 'C:\TEMP\AllUserLogFiles.txt'
If Exist($Dest)
Del $Dest
EndIf
$Folders = DirL($Path)
For Each $Folder In $Folders
If $Folder
If Exist($Path+'\'+$Folder+'\'+$File)
SHELL '%comspec% /c type ' + $Path+'\'+$Folder+'\'+$File + ' >>'+$Dest
EndIf
EndIf
Next

Function DirL($f)
Dim $a[0]
$f = Dir($f)
While Not @ERROR
If $f <> '..' And $f <> '.'
$a[UBound($a)] = $f
ReDim Preserve $a[UBound($a)+1]
EndIf
$f = Dir()
Loop
If UBound($a)
ReDim Preserve $a[UBound($a)-1]
Else
$a = 0
EndIf
$DirL = $a
EndFunction

Top
#167826 - 2006-09-21 03:22 AM Re: Need some help
Tony72 Offline
Getting the hang of it

Registered: 2002-06-18
Posts: 53
Is there any way to have it do my suggestion from before, just have it use DOS and do a "type logfile.txt>>compile.txt"?

I tried it myself, but I wasn't sure if I was screwing something up.

Top
Page 3 of 4 <1234>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 186 anonymous users online.
Newest Members
dimi575, Drecksnacken, Nlill, webtools321, multiman
17734 Registered Users

Generated in 0.054 seconds in which 0.015 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org