Below is retake on the Include subroutine which heads up the vast majority of my scripts. This incarnation puts a wrapper around Include and is called, for want of a better word, Configure. This subroutine takes no parameters at all. Rather, it builds up a filename based on WScript.ScriptFullName with ".cfg" tagged on, reads it in and then hands it over to ExecuteGlobal. This means that the .cfg file must contain functioning VBScript code.
Provided the .cfg sits side-by-side with the .vbs, the .vbs should work. And if you change locations, change the .cfg code. If the .cfg can't be found, you get an error message. I haven't put in any error trapping yet.
Had fun with "With"/"End With" on this one.
So in the .vbs we haveand in the .cfg we have (for example)
Past (20 years or so) and present code. A variety of languages and platforms. Some gems. More gravel. Some useful stuff and some examples of how not to do it.
Thursday, November 23, 2006
Saturday, November 11, 2006
[Observation] freshmeat, no. CodePlex, yes?
Seems that freshmeat don't want Windows-only projects. So it may be CodePlex you'll find the project on. More details when they come to hand.
Labels:
CodePlex,
freshmeat,
open source
[Delphi] COM of libiconv
I have just finished my first serious bit of Delphi programming, using Turbo Delphi Explorer. As a RAD/IDE it's pretty good. However, given the limitations of the Explorer version, I'll upgrade to the Pro version fairly soon.
COMlibiconv is an in-process COM object and was born out of the company's need to convert some multibyte encodings into Unicode. It's based on DIConverters, a unit made available by Ralf Junker of The Delphi Inspiration. DIConverters is licensed as LGPL. COMlibiconv will also be LGPL.
(Did I mention that I'm working again? No? Okay, well now I work as a software engineer for Strapper Technologies, of Fremantle, WA, Australia, makers of the Protium language.)
I'll be posting version 1.0 of the project up on Freshmeat by the end of next week, God willing.
COMlibiconv appears to work. I've used it in VBScript, late-bound, as and I think my boss has used it, early-bound, in VB6.
At this stage the methods and properties exposed are as follows (taken from the source):The function iconv_toUnicode takes a string defining the name of the multibyte encoding, the string to be converted, and two integers stating where to start and when to finish. I should probably give those default values so that the method can be called with just the encoding and the string.
ErrorCode contains an integer value which, when Success is false, represents what went wrong. An enumeration of possible error values is indicated and may make it into the next version.
Aliases gives all the various names for an encoding, indexed by a number from zero to the number of encodings (which can be found using Count).
CNames is also indexed in a similar way, and returns what I have called the 'CName' of the encoding. It's stuff that was in the DIConverters unit. I haven't found a use for it, but included it anyway.
The next version will, God willing, contain a method to allow conversions from Unicode back to multibyte.
If you're interested in this, and it hasn't appeared on Freshmeat by 18th November 2006, write a comment to remind me.
© Copyright Bruce M. Axtens, 2006
COMlibiconv is an in-process COM object and was born out of the company's need to convert some multibyte encodings into Unicode. It's based on DIConverters, a unit made available by Ralf Junker of The Delphi Inspiration. DIConverters is licensed as LGPL. COMlibiconv will also be LGPL.
(Did I mention that I'm working again? No? Okay, well now I work as a software engineer for Strapper Technologies, of Fremantle, WA, Australia, makers of the Protium language.)
I'll be posting version 1.0 of the project up on Freshmeat by the end of next week, God willing.
COMlibiconv appears to work. I've used it in VBScript, late-bound, as and I think my boss has used it, early-bound, in VB6.
At this stage the methods and properties exposed are as follows (taken from the source):The function iconv_toUnicode takes a string defining the name of the multibyte encoding, the string to be converted, and two integers stating where to start and when to finish. I should probably give those default values so that the method can be called with just the encoding and the string.
ErrorCode contains an integer value which, when Success is false, represents what went wrong. An enumeration of possible error values is indicated and may make it into the next version.
Aliases gives all the various names for an encoding, indexed by a number from zero to the number of encodings (which can be found using Count).
CNames is also indexed in a similar way, and returns what I have called the 'CName' of the encoding. It's stuff that was in the DIConverters unit. I haven't found a use for it, but included it anyway.
The next version will, God willing, contain a method to allow conversions from Unicode back to multibyte.
If you're interested in this, and it hasn't appeared on Freshmeat by 18th November 2006, write a comment to remind me.
© Copyright Bruce M. Axtens, 2006
Subscribe to:
Posts (Atom)