Batch file help / Log file creation

muffins

Member
Okay, erm, this isn't really an ASH/CLI scripting request, but it pertains to working with them and KOLmafia, so...

What I am looking for is a batch file which calls a script and logs information from said script.

I'd like the logs filename to be in a format similar to "charname.adventurelocation.dateinYYYMMDDformat.txt"

And that log would contain (if at all possible:
Start Meat: The character's starting meat.
Items:
List of items gained (name and amount).
End Meat: The character's ending meat.

The file name could do without the character name if I could also include it in the data entered into the log. The adventure location will generally be the same, but may change at some point.

If any more info is needed, please let me know.

Thanks in advance :)
 
Well... I think you have a syntax / grammar problem in your request.

Are you looking for mafia to create files with the information you are asking for? Or are you asking for something more complex?

It reads like you simply want to record Starting Meat, List of Items Gained, and Ending Meat (and maybe a list of all starting items? That is some serious filing....).

And that is simple enough to do. I am not a logger, so I am not fully familiar with those commands... And asking for the date included is kind of rough...

Or are you asking for more?
 

macman104

Member
talk to efilnikufecin...he pwns batch files.

EDIT: Added elf's full name, "damnit, elf you need a shorter name, fuck you :)"
 

muffins

Member
Yeah, I actually found one of his scripts that had something that appears to be similar enough to what I'm looking for using ASH, the only thing missing is the date, which I would like to include, but it may not be entirely necessary... still, if anyone could help me figure out how to accomplish this (either using ASH or a batch file, or a combination of the two), I'd be grateful.

I wouldn't mind having a single log file as displayed in efil's script, but I would like to include the date somewhere, if at all possible.

Thanks :)
 
I have a method of obtaining the date in a script using a batch file, but out of respect for holatuwol's wishes I cannot let the information out.

The wishes I am referencing are:
He does not want kolmafia to be able to script the holidays.
He does not want kolmafia to be able to script for stat days.
He does not want kolmafia to be able to script for moon phases.

To write the date into your log file from a batch file, you would want the following in the batch file:
Code:
@echo off
echo.|date|find "current" >t#e.bat
echo set date=%%5> the.bat
call t#e.bat
del t?e.bat > nul
echo "%date%">>filename.ext
filename.ext is the name of the file you want the date written to. You would want to run this before starting kolmafia so that anything below the date is for that date. Make sure you have both >> characters before the filename. If you only have 1, it will delete the file, and start a new one. The deleted file will not be recoverable.

Note This method creates some files on your computer, then deletes them.
this batch file will also delete any file named t?e.bat where ? can be any single character.

I hope this method meets your needs.

Edit: removed a ; from the above code. I'm getting use to ash..a little too used to it ;D
 

muffins

Member
[quote author=efilnikufecin link=topic=128.msg574#msg574 date=1146443961]
I have a method of obtaining the date in a script using a batch file, but out of respect for holatuwol's wishes I cannot let the information out.

The wishes I am referencing are:
He does not want kolmafia to be able to script the holidays.
He does not want kolmafia to be able to script for stat days.
He does not want kolmafia to be able to script for moon phases.[/quote]

Understood. I have/had no desire for the date to be in/referenced by the script. I just wanted to know what I found on what date when I looked at the log files :)

I will test this by running it tonight after rollover and let you know if I need to do anything else or change anything.

Thanks!
 
Studying of the source code has revealed:
Code:
cli_execute(echo timestamp);
will achieve this in an ash script. No need for the external batch file.
Code:
cli_execute(echo kol-date);
will get (of-course) the kol date.
 
That kicks ass efilnikufecin.

Nice find!

Now if only I logged anything. :p

Actually... I know where I can put that... Hmmm.....
 
Top