KBD

Keith Devens .com

Saturday, November 22, 2008 Flag waving
"Let me get this straight. He met with terrorists? Oh, that's good." – John Edwards (on finding out John Kerry's own diary testified to him meeting with North Vietnamese terrorists in Paris)
← Goal for self (regarding e-mail)FILExt - file extension resource →

Daily link icon Tuesday, November 25, 2003

KiXtart - Windows scripting

I always try to keep any neat tools I find around in the back of my head in case I may have a use for them some day. I finally have a use for KiXtart[1], a scripting language for Windows somewhere between batch files and VBScript, with a lot more useful stuff thrown in, and without a lot of the anguish of either.

Previously I'd been using a Windows Script Host script in JScript to script (jeez) backups, but a few factors combined to make me switch. 7-Zip (which I'm using to do the backups) has a weird convention for command-line arguments that requires paths to be relative. So, I have to do a cd to c:\ and then specify the path names without the "c:\" on them. I found out that the way to combine two commands in one line on the command shell was to stick an ampersand between them. So, my command line was essentially "cd c:\ & {path to 7-zip}7z.exe {args, etc.}". While that worked fine from the command shell, for whatever reason WshShell.Run() choked on it. So I thought, screw this, the script was simple enough that I was just going to switch it back to using a batch file, which I'd been using in the past but switched from because I wanted to do some extra things such as pop up dialogs.

We back-up to CD-RW, and as I was about to put together the batch file, I thought it'd be nice to be able to check the size of backup.zip against the amount of free space on the CD, so I could find out before I tried copying the file that there wasn't enough room for it. I have no clue how to find out the remaining free space on a drive from batch files (besides "dir", but that doesn't give me something I can use programmatically). So, I went to see if KiXtart was what I wanted, and it totally is. It happens to have some handy functions called GetDiskSpace and GetFileSize that do what I want. No more fiddling with weird Windows Script Host objects to try to make them do what I want.

KiXtart really does a lot... it allows you to easily write to the registry, do stuff with Windows system stuff like manipulating users, it allows you to script applications using COM automation or plain old SetFocus and SendKeys functions, has good integration with the shell, and it even has an RPC service you can run to allow remote administration. KiXtart is really geared towards network administrators writing logon scripts. And of course KiXtart has the requisite set of BASIC functions. Smiley

However, I was very surprised when I found that there's an extension to KiXtart called KiXforms that allows you to write GUI apps using KiXtart.

So I'm psyched that I have a new tool in my disposal for scripting windows. I hope to never have to mess with Windows Script Host (huge pain in the ass) or try to hack up complicated batch files again. For more info, check out:

Footnotes:
[1]: which I discovered over two years ago... boy was the world different on that day

← Goal for self (regarding e-mail)FILExt - file extension resource →

Comments XML gif

ChuckO wrote:

There is a great KiXtart reference at this site: http://www.Dx21.com/scripting/kixtart/index.asp

∴ ChuckO | 12-Dec-2004 9:58pm est | #6605

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

November 2008
SunMonTueWedThuFriSat
 1
2345678
9101112131415
16171819202122
23242526272829
30 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 4 posts

Recent comments XML

Calif. Supreme Court to take up gay marriage ban

I would argue the point is not​definitional.  While the word​marriage is su...

Justin: Nov 20, 4:37pm

Java join function

Meh, don't have null strings in​your string arrays imo, but you're​welcome ...

Keith: Nov 19, 7:51pm

Girls, please don't get breast implants

sorry but another thing i have to​make a comment on about you​men...the men...

happynow: Nov 17, 11:36pm

Books by Vincent Cheung

to all Cheung​fans:

read:

http://www.progin​osko.com/aquascum/cheung.h...

Zamir: Nov 16, 9:07am

Generated in about 0.233s.

(Used 8 db queries)

mobile phone