How Can I Set Scriptomatic So That It Automatically Outputs to a Text File?

ScriptingGuy1

Hey, Scripting Guy! Question

Hey, Scripting Guy! How can I set Scriptomatic so that it automatically outputs to a text file?

— GD

SpacerHey, Scripting Guy! AnswerScript Center

Hey, GD. Well, all you have to do is – wait a second: you want to make changes to the Scriptomatic? Oh, GD: say it isn’t so. Would you paint a hat on the Mona Lisa? Would you give the Venus de Milo a tattoo? Would you completely redo Frank Gehry’s Experience Music Project building in Seattle?

OK, we’d redo the last one, too. But, GD, the Scriptomatic is a classic, and you simply don’t mess with the classics.

Oh, what the heck: it’s not that special. Here’s what you need to do:

First of all, it’s a good idea to download a copy of the Scriptomatic; thanks to our years of experience we’ve learned that it’s difficult to modify a script unless you actually have a copy of that script. Once you have a Scriptomatic to call your own it’s probably a good idea to make a copy of it before you start messing around with the code. That makes it easier to start all over again just in case something goes horribly wrong.

Not that the Scripting Guys would know anything about things going horribly wrong, mind you.

Next, you need to open the Scriptomatic in Notepad or some other text editor. (As if there was any text other than Notepad!) When you’ve done that, search for this line of code:

g_strOutputFormat        = “CmdLine”

The variable g_strOutputFormat keeps track of Scriptomatic’s current output format. As you can see, the initial output format is set for the command prompt. To change that to text file output simply set the value of g_strOutputFormat to PlainText:

g_strOutputFormat        = “PlainText”

Technically that’s all you have to do: if you save the file and start Scriptomatic it will default to outputting information to a text file.

The only problem is that, at first glance, it won’t look like it’s using Plain Text as its default output format. That’s because we haven’t modified the default settings for the Output Format radio buttons:

Scriptomatic


Everything will work, but it’s definitely a bit weird to have the output format seemingly set for Command Prompt yet actually going to a text file.

So can we fix that as well? Of course we can. All we have to do is search for these two lines of code; you’ll find them near the bottom of the Scriptomatic:

<tr><td><span style=”font-size:8pt;”>Command Prompt</span></td><td>
<input type=”radio” name=”output” onClick=”SetOutputFormat(‘CmdLine’)” CHECKED></td><tr>
<tr><td><span style=”font-size:8pt;”>Plain Text    </span></td><td>
<input type=”radio” name=”output” onClick=”SetOutputFormat(‘PlainText’)”></td></tr>

Do you see the CHECKED parameter added to the Command Prompt <input> tag? That parameter means that we want the Command Prompt radio button to be selected by default. Of course, now we no longer want Command Prompt to be selected by default; instead, we want Plain Text selected by default. So how do we fix that? You’re absolutely right: we remove the CHECKED parameter from the Command Prompt <input> tag and add it to the Plain Text tag instead:

<tr><td><span style=”font-size:8pt;”>Command Prompt</span></td><td>
<input type=”radio” name=”output” onClick=”SetOutputFormat(‘CmdLine’)” ></td><tr>
<tr><td><span style=”font-size:8pt;”>Plain Text    </span></td><td>
<input type=”radio” name=”output” onClick=”SetOutputFormat(‘PlainText’)” CHECKED></td></tr>

Save the file, start Scriptomatic, and you’re in business:

Scriptomatic


Incidentally, while we don’t encourage you to paint a baseball hat on the Mona Lisa (at least not the actual Mona Lisa) we definitely encourage you to modify and customize the Scriptomatic all you want. We’d love to hear what you’ve done with your copy of the Scriptomatic. If you’ve enhanced the coding capabilities, added a new language, painted flames on the side, or otherwise souped-up the old Scriptomatic, drop us a line at scripter@microsoft.com (in English, if possible) and let us know what you did.

0 comments

Discussion is closed.

Feedback usabilla icon