The LnzScript 0.4 release is here! This scripting tool can automate repetitve tasks in Windows, work with files and folders, and easily perform text manipulation.
The editor makes it easy to write quick one-off scripts. Standard output appears in a pane to the right.
Let's say you have some text that you want shuffled randomly. If one were to write a Python script, you'd have to save the text
in a temporary file, or load some library to access the Windows clipboard. With LnzScript, the clipboard is directly accessible without importing anything. One could just write Clipboard.set(Math.shuffleArray(Clipboard.get().split('\r\n'))) Furthermore, the LnzScript Editor can run a script before it has even been saved to a file, a unique feature, so you can run a script immediately.
LnzScript 0.4 includes more methods for working with files. File.dirListFiles(@'c:\myfolder', '*.txt','size') returns all of the text files in the directory, sorted by size. File.copyMany can copy full directories. File.createShortcut and File.getShortcutTarget can work with shortcuts. The Rename.renameFn will call a function you provide to rename files. To rename .jpeg to .jpg, say, all you need to do is:
Rename.renamePreview can be used to see the results before renaming anything.
And, it's still good at automating tasks. I used it to access Webmail (for which there was not a 'remember me' option); much faster than typing in the fields every time. An old demo of LnzScript opening Firefox tabs is here.
The installer associates script files so that you can run them by double-clicking. Just by using argv in a script, you can now drag and drop a file
into the script and it will run with that argument in argv, a 'droplet.' Lately I've been using Clavier+ to assign scripts to hotkeys. Other programs such as Launchy could also be used.
the good parts can be very useful. I've added @'string' literals to the language, that can
contain single backslashes, so that one can type @'c:\foo' instead of 'c:\\foo'. There are other additions like include(), alert(), print(), and argv.
Parsing .url shortcuts in a directory and printing out URLs:
var arFiles = File.dirListFiles('.', '*.url')
for(var i=0; i<arFiles.length;i++)
var pageName = arFiles[i].slice(0,-4)
var url = File.readFile(arFiles[i]).split('URL=').split('\n')
print(url + '\n')
return (i<10)?'0'+i+s : i+s;
//first, preview to see consequences