I have a couple of scripts in xtools that tackle this kind of problem:
SLCFix.js
//
// SLCFix.js
// This script does some minor massaging of ScriptListener output
// primarily by substituting charIDToTypeID and stringIDToTypeID with
// cTID and sTID. In the process of doing this replacement, the
// 'var id##' style declarations are removed in the c/sTID calls
// placed inline. You'll need to copy the c/sTID definitions from
// this file into whatever file you decide to use the converted code.
//
// One other piece of corrective surgery is to canonicalize all
// filename strings to use '/' instead of '\' characters. I didn't bother
// messing with the drive names.
//
// The only thing left that I don't really have a solution for is Actions
/// that invoke scripts. For some reason, the return value of the script
// is placed in the action and gets output to the ScriptingListener log
// file as well. Search for 'jsMs' to see what I mean. Unforunately, in
// many case, the return value is effectively the last piece of textual
// code parsed, I think. There is not an easy way that I have found to
// remove this travesty after the fact, except to do it manually by replacing
// the code with an empty string, "". You can, however, remove it before
// the fact. Make the last line of your script files 'true;' or, like I do,
// the name of the script as a string, e.g. "SLCFix.js"; This has the nice
// added benefit of showing up in the debugger console if you are running
// the script from within the debugger.
//
// I've converted up to 20,000 lines of ScriptingListenerJS.log code in one
// pass with the only problems being the 'jsMs' garbage. That can, as I said
// before, be fixed manually.
// !!! This may gave been fixed!!!
//
// $Id$
// Copyright: (c)2005, xbytor
// License: http://www.opensource.org/licenses/bsd-license.php
// Contact: xbytor@gmail.com
This handles complete SL log files. There is also an option to use symbolic variables instead of cTID or sTID expressions.
There is also LastLogEntry.jsx which I use more frequently. Do something in PS, run this script, hit the Fix button and you get something that is a lot more readable and smaller. Remember, however, that not all actions in PS are recordable.
//
// LastLogEntry.js
// Get the last entry from a ScriptingListenerJS.log file.
//
// $Id$
// Copyright: (c)2005, xbytor
// License: http://www.opensource.org/licenses/bsd-license.php
// Contact: xbytor@gmail.com
//
Both of these 'include' other files (like stdlib.js). I you don't have xtools installed, substitute /xapps/ with /apps/ to get a self contained script. I tend to reuse/include previously written code which is why the /apps/ code is a lot thicker than it needs to be. But, then again, I only need to fix a bug or enhance a feature one place instead of five.
The scripts handle funky file path stuff and a few other odd things and has been used by Adobe for internal research stuff so I have to assume it is fairly stable in addition to be fairly old but continually refined.
It's good to see others do similar (and more light weight) implementations.
... View more