Questions & Answers

  1. What is PowerPro?
  2. What is PowerPro for?
  3. How much does PowerPro cost?
  4. Where to download PowerPro?
  5. What is a script?
  6. Why use scripts?
  7. Can I use scripts if I am not familiarized with the script language?
  8. What is a PowerPro plugin?
  9. Where to download PowerPro plugins?
  10. What are script parameters?
  11. Is PowerPro worth keeping in memory?
  12. How to run a script if PowerPro is loaded?
  13. How to run a script if PowerPro is not loaded?
  14. How to assign a script to the Total Commander's hotkey?
  15. How to assign a script to the Total Commander's button?
  16. Are all the scripts ready to be run on my computer?
  17. Can I modify your scripts? Simplify them? Add new functions? Fix bugs in them?
  18. Why script ZZZ displays the error message about the VEC plugin?
  19. Why script ZZZ displays some other error message? Why ZZZ does not work as expected?
  20. What is Xxcopy? Why do you call it from your scripts?
  21. Have I to learn all the Xxcopy switches to use them in your scripts?
  22. How much does Xxcopy cost?
  23. I've written my own PowerPro script for Total Commander. What should I do?
  24. What other questions should I ask?
  25. What questions should I never ask?

Q: What is PowerPro?
A: Bruce Switzer, the author of PowerPro, answers this question better than somebody else.
Q: What is PowerPro for?
A: Here I give some examples. Want to learn more?
Q: How much does PowerPro cost?
A: Nothing. It's freeware.
Q: Where to download PowerPro?
A: The latest version is here.
Q: What is a script?
A: In a few words, script is a simple open-source program. Bruce Switzer gives the more detailed and comprehensive explanation of what the script is. First download PowerPro (see previous answer), install it, then open the ppst.chm file, read it chapter by chapter, and find all the answers there.
Q: Why use scripts?
A: Some people use scripts just to save time. Some people do that to automate difficult and/or boring jobs. Some people lack specific functions in programs they use, and make scripts fill these deficiencies.
I'll give some examples of using PowerPro scripts with Total Commander.

Example 1. Local menus
Some file managers, including Norton Commander, precursor of Total Commander, have so-called local menus, that is, those dependent on the current directory. This feature is requested by Total Commander users many times but is not still implemented by Mr. Ghisler. Well, using PowerPro script I realized this idea and now I have 5 local menus in different directories. I invoke them by pressing the F2 key (as in Norton Commander). So, if the specific file (_local.bar) is present in the current directory or its (grand)parent, the local menu is displayed, otherwise the default command ("Reread source") is executed.

Example 2. Merging bars
Suppose you have two button bars, First.bar and Second.bar, 12 buttons on each. You want to merge them into a single button bar. How to do so?
First way is to implement the following procedure 12 times:

Is it boring? No, it is extremely boring!

Second way is to merge files directly and then edit the resulting file, changing cmd9 to cmd21 and so on, totally about one hundred edits. Is it better than the first way? It's an iffy question!

How to do the same with my script?

Example 3. Saved search
Do you use saved searches? Open the "Find file" window (Alt+F7 by default) and switch to the "Load/Save" tab. Is your list empty? My list comprises 23 saved searches. How to perform a specific search?

I am too lazy to do all that each time. I prefer to have a button bar with 23 buttons, one per search. I prefer to do only one mouse click rather than 5 (at least). Are you as lazy as I am? I hope you are.

Example 4. Edit comments of several files
Suppose you have many digital photos. After viewing you divide them into groups:

The best way to comment a file is provided by Total Commander and is named "Edit file comment" (Ctrl+Z by default). Pay your attention to that the "file" word is in the singular. It's a pity you need to add the same comment to some tens or even hundreds of files from each group. Of course, there is the only, and time consuming solution: make the file list, save it as descript.ion, and then drag comments from one file name to another, switching every time from viewer to the text editor...
I prefer doing as follows. Open quick view window, and using Down and Ins keys mark files from the first group, and finally run the script. As a result, the Upload to my site comment will be assigned to all these files. If some group contains only one file, the cm_EditComment is executed, and nobody could see the difference between it and the script. Moreover, if my intensions regarding some file change, its comment would be like Oh hell... Never show this to my wife! Well, I am not sure though....
Q: Can I use scripts if I am not familiarized with the script language?
A: Of course you can, even if you haven't the slightest idea of programming.
Q: What is a PowerPro plugin?
A: It's a file with the dll (Dynamic Link Library) extension, coded by a qualified programmer. This file contains some functions called from a PowerPro script like this:
plugin_name.function_name(parameters)
For example, to retreive the size of the TotalCmd.exe file, I write the following line in my script:
a = file.size("TotalCmd.exe")
Then the a variable gets equal to "837156" (version 6.53).
Q: Where to download PowerPro plugins?
A: I use three sources of plugins:
  1. PowerPro installation package. If you have PowerPro installed, go to the plugins\ subfolder of the PowerPro installation folder. There you'll find the following plugins: au.dll, clip.dll, date.dll, and others;
  2. Huge archive of additional plugins and utilities. In my scripts I use ini.dll, miscplugin.dll and osd.dll plugins from that archive. Just extract these files to the plugins\ subfolder, and they are ready to be called from the scripts;
  3. Two plugins: childwin.zip (to work with child windows) and tc.zip (to work with Total Commander). Download and extract them to the same subfolder.
Never rename, move or delete any *.dll files from the plugins\ subfolder!
Q: What are script parameters?
A: If you are acquainted with programming it's enough to note that parameters (or "arguments" in terms of PowerPro) are similar to arguments of any function, procedure, or subroutine. Two main distinctions are that PowerPro script parameters have fixed names (arg(1), arg(2), etc.), and their maximum quantity is 9, just as in batch file scripting language.
If you've never programmed, I'll try to answer this question by the example of script SubDirList. This script creates file and/or vector with a list of subdirectories of the current directory. It's obvious that each time the script is executed the current directory is different, and always corresponds to the %P parameter of Total Commander valid in the "Parameters" field of a button. So, the first parameter of the SubDirList script is "%P" (note the double quotes).
The second parameter of the SubDirList script defines where the list should be stored. If you prefer to use the list in your script, it's reasonable to set the second parameter equal to "v" (abbreviation of "vector"). If you would like to save the list as file named _subdirs.lst in the directory in question, then the second parameter is "f" that means "file". Finally, to have both vector and file, set the second parameter equal to "b" (descending from "both"). There is no more possible values of the second parameter: if you need neither vector nor file, why run the script?
As a result you have to pass the following string as a parameter to PowerPro:
runfile.SubDirList("%P", "b")
Pay your attention to the difference between PowerPro parameter and script parameter! PowerPro command line parameter is similar to the parameter (or key) of any program, for example, /N parameter of Total Commander. In the above example the PowerPro parameter is represented by the whole line.
On the contrary, the script parameters (or arguments) in the above example are "%P" and "b". Each script parameter is always included in quotes. If there are two or more parameters, they are separated by comma. Usually the string parameters ("b" in the example) are case sensitive unless the contrary is specified. That is, "B" can not be the second parameter of the SubDirList script.
Some scripts require parameter(s), some others don't. For example, below some of my scripts are called:
runfile.EditFileComments("%L")
runfile.Duplicate("%P%O", "%E")
runfile.LoadBar("D:\Utils\TotalCmd\PanelView.bar") 
runfile.SisterDel("%P", "%O", "%E", "1", "b")
runfile.QuickViewWLXPlugins
Script QuickViewWLXPlugins doesn't need any parameters.
In the conclusion it should be reminded that Total Commander parameters like %P, %T, can cause problems when equal to names with spaces. So, some scripts accepting these parameters can work incorrectly. If this happens, try to type their names in lowercase (%p rather than %P, etc).
Q: Is PowerPro worth keeping in memory?
A: Yes, it is. When installing PowerPro you'll see the following window:

Only one thing you have to do is to leave the first checkbox selected. It allows you to use all the PowerPro capabilities: redefine hotkeys (including application-dependent), create bars and menus (or use those included in the installation), set timers, schedule tasks, work with sticky notes, create virtual desktops, etc. Please take into account that after installing PowerPro you could get rid of many small programs that provide these functions - it will free not only the disk space, but the RAM and startup time, too. Finally, if you are not yet ready to work with PowerPro, just do nothing and leave it in memory. It takes only about 1.5 Mb of the RAM (for comparison, Total Commander takes about 9 Mb!).


Q: How to run a script if PowerPro is loaded?
A: There are some ways described in details in the PowerPro manual. I'll tell you about one of the simplest. Just execute the following command:
<path>powerpro.exe runfile.scriptname(parameters)
<path> is a path to the folder where PowerPro is installed (usually c:\Program Files\PowerPro\). scriptname is a name of file with the powerpro or txt extension, located in the scripts\ subfolder of <path>. This subfolder is created automatically at the PowerPro installation and is initially empty.
Q: How to run a script if PowerPro is not loaded?
A: It's more complex than in the previous case.
Download PowerPro plugin archive. In fact it includes not only plugins, but also some utilities especially destined to work with PowerPro. You need the ppbang utility and its advanced versions (ppbangOnce and ppbangTwice). These utilities are often updated, so you need to download the latest version and familiarize yourself with readme files. In brief, the ppbang* utilities try to pass the script to the running instance of PowerPro. If it is not running, they can first run it.
Q: How to assign a script to the Total Commander's hotkey?
A: If you are aware of how to do it for whatever program, you'll not find anything new in this answer.
  1. Pick Total Commander menu: "Start\Change Start Menu\Add Item";
  2. Type any suitable name, for example, Test Script;
  3. In the "Command" field specify a path to the PowerPro or use the ">>" button to browse. Result is like d:\Utils\PowerPro\PowerPro.exe;
  4. In the "Parameters" field type runfile.SomeScript, where SomeScript is a name of the script. Note that neither extension (txt or powerpro) nor path (scripts\) is specified;
  5. If a script has no parameters, do not type anything else. But suppose the script requires two of them: current path and number 5. So type runfile.SomeScript("%P", "5");
  6. Press "خت";
  7. Open the configuration file wincmd.ini, find the [user] section and keys like
    menu14=Test Script
    cmd14=d:\Utils\PowerPro\PowerPro.exe
    param14=runfile.SomeScript("%P", "5")
    

    Here 14 is a user command number given by Total Commander, and you have to learn this number. There is no need to edit the wincmd.ini file;

  8. Open the Totalcmd.inc, find the [user] section again and type
    cm_usermenu14=714;Test Script
    
    Number 714 is a unique identifier of the user command;
  9. Pick Total Commander menu: "Configuration\Miscellaneous", then choose a hotkey in the "Redefine hotkeys (Keyboard remapping)" list. At the end of the "Commands" list find the [user] section (for the third time). Choose our new command cm_usermenu14 (Test Script);
  10. Confirm your choice with the green "V" button and finally close the window by "خت".

Q: How to assign a script to the Total Commander's button?
A: It's much simpler:
  1. Pick Total Commander menu: "Configuration\Change Button Bar";
  2. Press "Append";
  3. In the "Command" field indicate the PowerPro path, for example, d:\Utils\PowerPro\PowerPro.exe;
  4. In the "Parameters" field type runfile.SomeScript("%P", "5");
  5. In the "Icon file" field set a corresponding icon;
  6. In the "Tooltip" field write Test script;
  7. Press "خت".

Q: Are all the scripts ready to be run on my computer?
A: Most of them are. If not, you have to edit the script code a little bit - usually to indicate path to some files. I mark such places with blue. For example, in the script code you see the following line
global Config = "path\wincmd.ini"
It means that you have to indicate where the wincmd.ini file is on your computer. To do that, pick menu "Help\About Total Commander" and read the "INI-files" section. Then open the script file in any text editor and type the actual path there. Now the script is ready to be run on your computer.
Q: Can I modify your scripts? Simplify them? Add new functions? Fix bugs in them?
A: Of course you can. Moreover, you are encouraged to do that! If you believe that your modification of any kind would be interesting or useful for other people, it's a good idea to send me your version of my script. I'll publish it with your name/nick in the "Author"... sorry, "Authors" field.
Q: Why script ZZZ displays the error message about the VEC plugin?

A: Sometimes I can see the same window... It seems that the vec plugin contains some bugs. Just run the script once more. I've never seen two such messages in turn.


Q: Why script ZZZ displays some other error message? Why ZZZ does not work as expected?
A: If you have successfully run script ZZZ before, first try to run it again. If the error message re-appears try to shut down PowerPro, run it again and then re-run the script.
If ZZZ has never worked, it seems that you did not ensure everything for it to run. Read the script description carefully and check that:
Q: What is Xxcopy? Why do you call it from your scripts?
A: In brief, Xxcopy is a console utility to manage files and directories. To learn more, visit the Xxcopy homepage.
I call Xxcopy from my scripts because despite all the undoubted advantages of PowerPro, in some cases it shows less stable behaviour than Xxcopy. One of examples is given by TreeDown and TreeUp scripts, on one hand, and TreeDownX and TreeUpX, on the other hand (letter "X" means "using Xxcopy"). All these four scripts execute pairwise the same functions: TreeDown and TreeDownX move down the directory tree (go to the next directory), TreeUp and TreeUpX move up (previous directory). Moreover, the TreeDown and TreeUp scripts are slightly faster than TreeDownX and TreeUpX, but... only if the quantity of files and directories is not too great (up to some hundreds). If there are some thousands of them, the operating speed of TreeDown and TreeUp scripts falls drastically. Sometimes the computer even hangs.
I don't like when my computer hangs. I believe that you do neither. So I developed TreeDownX and TreeUpX scripts that call Xxcopy to make the file list. As a result, the scripts work fine with whatever number of files.
Q: Have I to learn all the Xxcopy switches to use them in your scripts?
A: No, you have not. You have to download and install Xxcopy, and to indicate path to it in the script code. It's quite enough for the script to work.
Q: How much does Xxcopy cost?
A: Xxcopy exists in two versions: freeware (for personal use or product evaluation), and professional (for routine commercial usage in a corporate environment). The former version have some properties disabled. I don't use these properties. I downloaded the freeware version and I use it in my scripts. You can do the same.
Q: I've written my own PowerPro script for Total Commander. What should I do?
A: Great! Send your script to me by e-mail. It would be nice to accompany it with a description similar to that for my scripts. I am certain to publish it with your name/nick in the "Author" field.
Q: What other questions should I ask?
A: Unfortunately, I can't promise that I would answer any question concerning PowerPro scripts for Total Commander, but I'll certainly try to. In fact, most of your questions can be reduced to one of the following:
  1. Why script ZZZ does not work?
  2. I need a script to do the so-and-so for me. Can you develop this script?
  3. Your script ZZZ is fine, but why it lacks the so-and-so function?
Perhaps I can anticipate your questions with the corresponding answers:
  1. First read my answer. If it still does not work, familiarize yourself with the configuration that all scripts are developed and tested in: I can't guarantee the script functioning in other configurations, for example, under other Windows versions.
  2. If I need so-and-so myself, perhaps I'll try to develop this script. In this case your name/nick will be indicated in the "Author" field as follows: "idea by Somebody".
    Most probably the so-and-so is a problem that I am not interested in. In this case my answer is most likely negative: no, I can't.
    Finally, it's quite possible that so-and-so problem can be solved with PowerPro by neither me nor somebody else. You should take into account that the PowerPro scripting language has very modest capabilities as compared with programming languages like C++, Delphi, or Java.
  3. First, may be it cannot be implemented because of the PowerPro limitations. Second, I don't need the so-and-so function, but I'll probably try to develop it. Third, I've just lost sight of this function - in this case I'll do my best to develop the so-and-so function and add it to the ZZZ script.

Q: What questions should I never ask?
A: I'll hardly answer questions about:
Main Page Total Commander PowerPro