| language
Information, tips and tutorials for ZTree file manager
s_Introduction_to_ZAM_scripting
Introduction to ZAM scripting
Writing scripts for ZTreeWin is like writing batch files in Windows. The only difference is the ability of ZTreeWin to insert proprietary batch parameters and environment variables at execution time. For example: current file name, directory name, drive, path, tagged file list, executable's location, and so forth. So basically, it's batch file creation with some added features.For this reason most of techniques involved in writing scripts are not ZTree-specific, and are documented in numerous places outside of ZtreeWin. You can search the web for the fundamentals of batch language and easily find thousands of good reference pages.
A few good starting tutorial and references can be found here:
- http://www.robvanderwoude.com/index.html
- http://www.allenware.com/icsw/icswidx.htm
- http://www.chebucto.ns.ca/~ak621/DOS/BatBasic.html
- http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_o.mspx
- alt.msdos.batch.nt
- alt.msdos.batch.win9x-me
Limitations of batch language
But the power of batch creation comes also with a very strong limitation: cross-platform inconsistency. With each new iteration of Windows, Microsoft slightly changed the command interpreter, the biggest gap being between Windows 9x/ME and Windows NT/2000/XP/Vista. This means chances are stronger that the batch won't run properly on every OS for more sophisticated commands or syntax.This is a hassle.
Example1
Under NT, a valid copy command syntax is:
copy source destination /V /N
but under 2K/XP/K3 the syntax must be written like this:
copy /V /N source destination
Example 2
The SET %DATE% command is valid with 2K/XP.. ...but not under Win98 !
There are hundreds more differences between 95, 98, Me, NT, 2K, XP, and 2K3 (including server and non-server versions)
This is not very practical but we have to live with it!
For in-depth information about batch language cross-platform inconsistencies, have a look here:
There are different ways to prevent some of the inconsistencies:
1. Use only basic commands...
... but many operations are just then impossible to perform!
2. Write different versions/ subroutines of every script for every system, with OS error handling and trapping...
... but this is technically challenging and requires a good knowledge of each OS. Also, there are things that CAN be done with some versions of Windows and CANNOT be done with another version using only batch language techniques, even with script variations and lot of imagination
3. Use cross-platform external utilities...
... this is a valid solution as long as utilities are small, free and OS independent. Using external utilities is sometime MUCH easier than relying solely on batch language (which is very limited) and are often more cross-platform compatible.
However, there are two shortcomings to this solution:
1) you must find the right utility
2) It forces other users to download and install the utility before running the script.
4. Use an extended batch command library (such as http://thesystemguard.com
These replacements or extensions of the default command interpreter give much more than only cross-platform compatibility. They are actually packed with hundreds of new commands not available with any standard Windows command interpreters. But they also defeat the goal of an universal scripting system simply because they are commercial.
5. Use another scripting language, more universal, powerful, and platform-independent, like VBscript, Perl, or WinBatch...
... but this is outside the realm of F9 menu.
This said, it is also possible NOT TO CARE so much about cross-platform consistency in ZAM scripting... After all, Windows batch language is, at best, some kind of "duct tape" and was not intended to be an universal solution. With this pragmatic philosophy in mind, a batch file could essentially be good when it WORKS on YOUR system(s). End of it
What you'll decide to do ultimately depends on your technical abilities and your needs. If you are a professional IT administrator managing daily different OS, you may have no other choice than opt for cross-compatible solutions. But if you are a power user or an administrator within a mono OS environment, you may less care about cross-compatibility.
Contributors to this page: JohnG
,
laurent
and
ian
.
Page last modified on Saturday 04 of August, 2007 19:07:51 EDT by JohnG.
