RSS

Subscribe to my RSS feed!


Subscribe to my RSS feed!

Armory Links

Insane in the Membrane

Bloodsail Buccaneers
51030/51000 rep
Booty Bay
26456/84000 rep
Everlook
26453/84000 rep
Gadgetzan
26976/84000 rep
Ratchet
33568/84000 rep
Ravenholdt
63906/84000 rep
Darkmoon Faire
51577/84000 rep
Shen'dralar
56100/84000 rep

RSS Recent Activity

Archiving your combat log and screenshots (for Windows)

(3:37:17 PM) Nibuca: Lesson learned: make sure to delete your wow combat log more often than once every 4 months

For those of you who log, for use with WoW Web Stats or one of its ilk, you may not have noticed but there are a couple interesting facts about the WoW combat log:

  1. It’s super-verbose, meaning it grows really quickly as a result, and
  2. WoW never deletes it, archives it, or starts a new one – when you turn off then turn on logging, WoW will gleefully keep appending to the same file.

As a result you can end up with a combat log over 5 million lines long, like Nibs above. Yikes! Well, if you’re a Windows user, I’ve got a solution you can use to automate some of this, to take the tedium out of needing to edit a log or archive it manually. Follow me past the break…


Installing PowerShell and Preparing to Run Scripts

Alright, the first thing you’ll need to do is download and install Windows PowerShell. This was one of the much-touted features of Vista back when Vista was still called Longhorn, but like many of those pie-in-the-sky features it got stripped out. This is unfortunate, because the eventual result – PowerShell – is a nice flexible scripting language for Windows, with some built-in safety mechanisms that things like batch files just don’t have. (In fact, execution of scripts is actually disabled by default. We’ll work around that.)

On the other hand, since it’s not a pack-in with Vista, you’re actually able to install it on Windows XP SP2, Windows Server 2003, and Windows Vista. Snazzy! Anyway, hit the download page to grab it. The install is fairly straightforward, and you shouldn’t need me to hold your hand to walk you through it.

When you’re done, you should have a Windows PowerShell entry in your Start Menu. Open it up, and you’ll get a window that … looks a hell of a lot like a DOS prompt. In fact, a lot of your familiar DOS commands (like ‘dir’, ‘rename’, etc.) will still work just fine.

7bbf2430a98702749c6c81cb9a7bb68b

What you’ll want to do, in order to run the scripts I’ve got linked later on in this post, is enable your PowerShell installation to run scripts you’ve written yourself without a question, but not those you download from the internet unless they’re from a trusted signer. To do that, at the prompt, type:

Set-ExecutionPolicy RemoteSigned

… and press enter. Voila! You’ll actually see… absolutely no feedback. Whoops. That’s intentional. But if you want to make sure it worked, you can type:

Get-ExecutionPolicy

And after you press enter, it will return what the execution policy for your system is. If you see “RemoteSigned", you’re good to go.

Getting and Running the Scripts

First things first, download this zipfile: TSFArchiverScripts.zip. Inside you should see two files, ArchiveCombatLogs.ps1 and ArchiveScreenshots.ps1. Take these out of the zipfile, then open each of these up using your text editor of choice; by default, if you have nothing else, you use Notepad. (I prefer Notepad++. But to be honest, text editors are kind of like religions: everyone has one they like, no one can explain to you why they like the one they like, and if they do try and explain it, the reasons why are totally alien to you.)

At the top of ArchiveCombatLogs.ps1, you’ll see this line:

$default = "C:\Users\Public\Games\World of Warcraft\Logs\WoWCombatLog.txt"

Change that to the actual location of your WoW combat log – it may be at C:\Program Files\World of Warcraft\WoWCombatLog.txt, for example. Be sure and leave the double quotes intact!

Meanwhile, in ArchiveScreenshots.ps1, you’ll see this line:

$default = "C:\Users\Public\Games\World of Warcraft\Screenshots"

Again, change this to your actual screenshots directory – it may be C:\Program Files\World of Warcraft\Screenshots. When you change this one, leave the double quotes intact and do not put a slash after Screenshots!

Save each of these, then close them. That’s all the editing you should have to do. Move them to somewhere that doesn’t have spaces in the name, just to be safe – like C:\Scripts or something like that. (Mine are stored in C:\Users\Public\ .) PowerShell can be as picky about paths with spaces in them as DOS ever was.

Running These Scripts Manually

Now, it’s easy enough to run the scripts manually, assuming you still have your PowerShell script open. In fact, you may want to do just that to give it a shot! For the sake of argument, I’m going to assume you installed them at C:\Scripts like I suggested; if not, replace that with whatever you did use. In your PowerShell window, type each of the following lines, hitting enter after each one:

cd C:\Scripts

.\ArchiveCombatLogs.ps1

.\ArchiveScreenshots.ps1

That’s it! If all went well, you probably … actually didn’t see anything. Maybe some feedback from the screenshots script, but probably not. (You definitely saw feedback in BRIGHT RED from either one if you didn’t have a Screenshots directory or a combat log; if you feel you should, double-check your changes to the scripts from the steps above.)

What actually happened is that your combat log was renamed according to the last time it was written in – so if it had last been written to at 2pm, April 13th, 2009, it will be listed now as 04132009_140000_WoWCombatLog.txt (the date, followed by the hours, minutes, and seconds, followed by – duh – WoWCombatLog.txt.) If your system displays the dates in another format, this may break, but I believe PowerShell is fairly uniform.

As your your screenshots, you should now find subfolders in your Screenshots directory. Let’s say you have screenshots from April 12th, 13th, and 14th. Inside your Screenshots folder, you will now find a 2009 folder, which contains an 04 folder, which in turns contains folders named ‘12′, ‘13′, and ‘14′. And inside those? Your screenshots! Huzzah! (Again, foreign date formats may break this. If so, let me know and I’ll work on an internationalized version of this.)

Scheduling Your Tasks

Now, obviously running these manually all the time would be kind of a pain in the ass. That’s why we’re going to automate it! Automation is beauty, folks. It’s why we like addons like Outfitter. In Windows XP, click Start, then go to Programs or All Programs (depending on whether you’re using the Classic or Damn Fancy start menu), then to Accessories, then System Tools, then Scheduled Tasks. Microsoft has fairly clear directions on how to do this.

Double-click “Add Scheduled Task,” then use the wizard to create a new task. Here’s the relevant portion: when you get to the part where you have to pick a program to schedule, choose “Windows PowerShell” from the list and click next. Choose when you want to run it (it’s entirely up to you – I have it run while I’m not home). When you get to the part where you put in a username and password, you’ll want to put in the username of someone who can make changes to the folders and such where WoW is located. 99% of the time, this will be your own user account; on the off chance you’re not running as an administrator user, put an administrator user’s credentials in here.

On the last screen, check the box that says “Open advanced properties for this task when I click Finish.” Then… click Finish. This will pop up a dialog box with the PowerShell job’s info. What you’ll want to do is append the path to your script after the path to PowerShell, like so (here’s a picture, in case that was gibberish):

09f3a6aaa16dcaaaa82bc1c2569f3cea

Save it by hitting OK, and you’re finished! Do the same steps, only replace “ArchiveCombatLogs.ps1″ with “ArchiveScreenshots.ps1″.

In Vista, you’ll want to open up the Task Scheduler by going to the Control Panel, clicking Administrative Tools, and then opening Task Scheduler. On the right side, look for “Create Basic Task” and click it. Enter whatever name you like (I suggest something snappy, like “Archive Combat Logs”), give it a description if you really want to, and hit Next.

Again, just like in XP, choose when you want it to run on the next screen, then hit next again. When you get to the “Action” portion, you can choose from one of three options: we want “Start a program,” so choose that (by default, it should be selected) and hit Next.

In the box for “Program/script,” click Browse and look for the path to PowerShell.exe. Now, below that, add the script’s name in quotes that you wish to run – like “C:\Scripts\ArchiveCombatLogs.ps1″. Here’s mine, for example:

99b2597b3d8b90a0b524ab524bb1bb5b

Click next, make sure everything on the next screen looks fine, and click Finish. And that’s it! Enjoy your newly automated organized lifestyle.

Now if we could just get one of those Mac users to figure out how to do this with Automator for us… and those Linux people to whip us up a shell script… we’d have everybody covered. (Hint, hint.)

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

10 comments to Archiving your combat log and screenshots (for Windows)

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled