Snippets



This one was actually pretty hard for me to write, so I really hope, that someone will be able to use it. Practically, this is a parser of logs, that I create in other snippets with my HTA Logging, but it is way more. For starters it also parsers logs produced by AMUR and UARM software. For advanced usage it also provides functionallity to sort and filter. A sample of the parser is used in my HTA Launcher.
Note, that it also need to have follwoing JavaScript in your code:
CODE
In case of large logs
······
[Snippets]

Copying and moving files in VBS is pretty easy, right? But what if you need to at least try to handle errors? Like, cases when files are read-only, for example. Or when source or destination is a folder (which does cause errors in some cases). Or maybe you need some flexibility. These 3 functions will assist with all of the above. You choose source and destination, whether to move file or just copy and whether to overwrite the destination, if such file already exists there. With HTA Logging and
······
[Snippets]

This piece of code is to be used along side with Hash Checker and is, practically, useful only to compare .cfg files for AMUR and UARM software and nothing else. Such checks, are highly advisable, although are not enforced by Central Bank of Russia. This script uses my HTA Logging. Also requires a .cfg file similar to other snippets.
CODE
[Snippets]

This is a really simple function, but quite useful nevertheless due to its flexibility. In essence, this is a logging function (used by other HTA snippets of mine).
It requires several variables: logfile, logline, gui, append, msgtype.
Logfile is a path to a file to which we want to write something.
Logline is what we want to write.
GUI is, practically, a flag. If set to 1 or empty it will use Logline to output the same to script's interface (statusbar in my case). If set to any string - that string
······
[Snippets]

This code is to be used in conjunction with Hash Updater. It uses the hashlists generated by it and validates the files, logging everything and reporting mismatches using my HTA Logging. It also uses a status bar (same as can be found in HTA Launcher).
CODE
[Snippets]

This one is mainly useful for people working in Russian banks, but can be used by others as a basis, too.
Central Bank of Russia requires that a set of files need to be validated before running clearing software (and thus operations in it). Recommended software to do that is hashfile.exe by Validata (provided along with their crypto-software). Unfortunately, it's not really convenient to use it to get file hashes for a hundreds of files. This HTA code will solve this issue.
First of all it requires
······
[Snippets]

Sometimes you may need to provide easy access to a set of scripts (batch files). You can always give access to a folder where .cmd and .bat files lie, but this will require to provide access to each file separately or to all of them at once. In some cases it's better to use a simple GUI like this (screenshot taken in 4K with scaling and does not represent real look):

This is an HTA file (Visual Basic Script with HTML), To correctly work it will also require a configuration file like this (domain
······
[Snippets]

A really small script to allow creation of users by list. It creates them and adds to a local group to allow remote access. Use a file to list all users, one user on each line.
CODE
[Snippets]

File distribution may seem simple most of the time: just copy one file to a different folder. But sometimes, blind copying is not a good idea, because it may affect a partner system. If we have a system or service monitoring a set of folders for new files, that then imports them, blind copy may result in duplicate entries or, at the least, affect processing timings.
Below code is a sample of what can be done to somewhat mitigate this. The scripts checks for existence of files and then check selected
······
[Snippets]

Imagine, that you have a set of files on SFTP server, possibly with a general mask, like a date in their names (for easier identification) and you need to check if all of them are present without having access to actual server besides the SFTP connection.
If there are two or three files - easy. But what if there are hundreds of them and the count may vary? This script will help you.
You put a list of files into a filelist.txt in format like ".extension Mandatory" (instead of .extension another portion
······
[Snippets]

Sometimes you have a big archive, that for some reason you can't upload somewhere in one go and you want to split it, but not using standard zip functionality, because you also need to able to use each part of the zip independently. This script will do just that.
It is designed to split one archive with lots of .pdf into maximum of 6 parts using PKWARE's PKZIPC and my own Global Functions. But it should be possible to modify it to your liking, if needed.
CODE
[Snippets]

In my line of work I had to use some general functions quite often, so I put some of those in one file and use it as a function.
Two of the functions (getdate and datemath) were taken from ss64.com and are used to get a date in a desired format without depending on regional settings and also calculate dates (useful for getting previous business date or stuff like that).
PKZIPC and Tectia checks are functions to check for existence of proper software and use them properly. Doubt anyone will require
······
[Snippets]