Showing posts with label TCL. Show all posts
Showing posts with label TCL. Show all posts

Monday, October 28, 2013

Fun with EXCON

I took a bit of time to revisit a fun script I wrote some time back.  I felt it was time to improve on this and build a full parser and encoder using TCL.  Scripting is such a great way of manipulating and playing around with strings.  TCL is my natural choice at the moment.  So the final script I ended up is this.

This will accept a file path and attempt to read the contents.  It will print the output on stdout and can read a long list of EXCON instructions or encode ASCII text into EXCON.  One note on the parser code (which is just the old script).  It will always clear the binary buffer after every line.  The script also does not support the fancy ! instruction call to simply print out the binary value in the buffer by the previous command.

Sunday, September 8, 2013

TCL and the Blasted Dates!

So, I've had a programming task to do on TCL that involves things that I don't normally use.  This one was basically to take the first Sunday of a specific Month and Year.  After some time of researching and testing, I figured it out.  This entry is just for archival purposes.

% clock format [clock scan {Sunday} -base [clock scan "2013-05-01" -format {%Y-%m-%d}] -format {%A}] -format {%Y-%m-%d}

Base sets the base time for clock and the format for the return can be tweaked to whatever you want.  It's also worth taking note that -format parameter on clock scan only works on TCL 8.5 and above.

Thursday, September 27, 2012

EXCON Parser in TCL

Had a little programming fun implementing an EXCON parser.  This is implemented using TCL (as always) and basically prints out "Hello World!".  Nothing more than a simple exercise.



Thursday, January 19, 2012

Simple TCL script for renaming files

So, I got this bundle of files from work and the file name formatting weren't to my liking. Capitalizations and spaces are things I tend to avoid in Linux when possible as you need to use the backslash escape to get the filenames interpreted properly. Tab auto-complete would allow me to use them, but I just didn't like to see my filenames with all the backslash stuff on. So, I decided to whip out a TCL script to do the work for me. It's largely based off the first simple script I did and only took a few minutes to do.

To use it, you just supply the filepath with all the files you want to be renamed and it'll go through each one for you. The script isn't properly tested, so keep that in mind when using this. Its clean up is basically to change the capitalizations to lower case characters and replace all spaces with dashes.


Tuesday, February 22, 2011

TCL Code to convert Empathy Chat Logs to HTML

I have had it with Empathy and to completely sever my dependence to this Instant Messenger, I had written a TCL code to convert the chat log to something Pidgin finds easier to handle.

Please note that this script is in a very rough form and I cannot stress enough to BACKUP YOUR DATA. I've seen a couple of minor bugs but I think it should convert the messages just fine. This will delete the old log files after processing them, so please remember to BACKUP YOUR DATA.

THIS SCRIPT IS OFFERED AS IS WITH NO EXPLICIT NOR IMPLICIT GUARANTEES IT WILL WORK. USE AT YOUR OWN RISK.

Without further ado... TCL Script