FileCommander Help
Console


Console

The console is a powerful tool. With this, you can create your own scripts.


"Language" of the console

The console uses a specified language. Every command has its root unit. This unit specifies the command and the target. By the way, the console is in-case-sensitive (e.g. aPPliCAtion.MINImize is the same as Application.Minimize)

Example:

  Application.Minimize

Description:

  • Application is the unit. The unit Application controls every command, which controls the main program.
  • . (the dot): this is the separator between unit and command
  • Minimize is the command. In this case, FileCommander is minimized to the system tray.
Commands can have more than just one dot (example: FileListView1.Font.Color(clRed))

Every command must have its own line. So if you want to execute several commands, you have to make a new line for each command.

Example:

  Application.Minimize     Application.Restore DOES NOT WORK.

  Application.Minimize
Application.Restore
     IS CORRECT!

You can add comments to your script. Comments have to start with // at the begin of the line. If you add these two slashes at the beginning of line, the whole content of this line is not interpreted as a command.

Example:

  [SOME COMMANDS]
// YOU CAN ADD COMMENTS HERE
[CONTINUE OF COMMANDS]

You do not have to fill each line. Empty lines will be ignored by the compiler.

If you want to execute a command which needs parameters (like changing the folder of a browsing window), you have to know how to do this.
The parameters for any command must be added directly after the command, NOT in a new line. You start the parameter entry with ( and close the parameter entry with ). If you want to enter several parameters, you have to separate them with a , .

Example:

  EditMenu.Press(2,0)

Note: Some commands have parameters. If you want to add a string parameter which contains a space, you have to replace the space with %20


Now enough theory, lets make some scripts!


Making a script

Ok, lets try out our first script. We want, that FileCommander will minimize to the system tray and will restore a few seconds later. Ok, but how ???.
I will tell you:

Let's make it as easy as possible. Press Add, select Application and press Minimize.

If we would execute the script now, FileCommander will minimize to the task bar, but will not restore.
So we have to specify a waiting time. This can be done by pressing Add - Application - Wait(<Milliseconds>). Now we have to define the waiting time. The waiting has to be insert at <Milliseconds>. So lets replace <Milliseconds> with 5000 (5000 milliseconds are 5 seconds).

After that, we have to add the command what FileCommander should do after this time period: press Add - Application - Restore.
Your script should look like the following example:

  Application.Minimize
Application.Wait(5000)
Application.Restore


Now lets see what will happen: press Execute or Ctrl + R.

FileCommander minimizes to the task bar and after 5 seconds, FileCommander will be visible again.
Ok, this script was not very useful. So what, it was the first script



Now, lets make a more complex script:

Important: before executing the script, make sure that browsing window 1 is the active browsing window. If you are now sure, simply click with the mouse in the browsing window 1

Now here is a more complex script. You can try it if you want, but if you don't trust me, you can read the description below first

  EditMenu.Press(2,2)
Application.Wait(1000)
FileListView1.SelectWithMask(FileCommander.exe)
FileListView1.CopyFileList
EditMenu.Press(2,7)
Application.Wait(1000)
FileListView1.PasteFileList

Ok, now lets try to understand this script by reading line per line:
  1. EditMenu.Press(2,2) is a command to the main menu. It does the same as you do. If you want to press a menu entry of the main menu, you first select the menu. In your case, it is Edit. After that, the script selects the entry. The first entry is 0, the second is 1, the third 2 and so on. So the script chooses the Go to folder entry. If you think "what?!?" now, you have to know that each separator is an entry, too. Separators are these menus which only have a line in it and which you can't select. In your example, the menu entry 0 is Open, the menu entry 1 is the separator and the menu entry 2 is Go to folder. Ok, now we have the first parameter, but what means the second parameter: 2? This second parameter specifies the sub menu. The Go to folder menu has lots of sub entries, and the menu entry 2 is: .... right: FileCommander.
    As a summary you could say, the script does the same as you would do if you want to open the FileCommander folder. It selects the Edit menu, selects the second menu entry: Go to folder and presses the second sub menu entry: FileCommander. This script opens the FileCommander folder in the active browsing window.
  2. Application.Wait(1000) is important, because the folder loading process might not be done after opening the FileCommander folder. So we wait for a second, so every file should be loaded now.
  3. FileListView1.SelectWithMask(FileCommander.exe): with this command, the file FileCommander.exe is now selected. You can enter any mask here (e.g. *.exe), but this is another topic. So now, the browsing window 1 displays the FileCommander folder and the FileCommander.exe is the only selected file.
  4. FileListView1.CopyFileList. Now we have to copy the selected file(s) [in our case the FileCommander.exe] to the FileCommander clipboard.
  5. EditMenu.Press(2,7). Another main menu function. But now, it is not the FileCommander folder, it is the Desktop.
  6. Application.Wait(1000) This command has the same reason as number [2].
  7. FileListView1.PasteFileList. This command says, that the whole FileCommander Clipboard (in our case: FileCommnder.exe) should be pasted in the current folder of Browsing window 1.

As you can see, it is not that simple to create a useful script (although this script is not useful, too). These 7 lines only copies the FileCommander.exe to the Desktop. Ok, this was not an easy script, but as you can see, the names of the commands are almost an explanation for there functions.
If you press Add in the console, you can see the entry Examples. I have included two basic examples here (by the way, the second one is very usefull after modifying it for your needs.

As the end of this short tutorial, I want to show a script to change the color theme of FileCommander:

  // FileCommander 5: Green theme
FileListView1.BeginUpdate
FileListView1.Color(40,75,59)
FileListView1.SortColumnColor(20,70,40)
FileListView1.FolderFileColor(22,201,4)
FileListView1.HiddenFileColor(191,198,200)
FileListView1.SystemFileColor(93,174,124)
FileListView1.DefaultFileColor(145,157,58)
FileListView1.Font.Name(MS Sans Serif)
FileListView1.Font.Size(8)
FileListView1.Font.Style(fsNone)
FileListView1.EndUpdate

FileListView2.BeginUpdate
FileListView2.Color(40,75,59)
FileListView2.SortColumnColor(20,70,40)
FileListView2.FolderFileColor(22,201,4)
FileListView2.HiddenFileColor(191,198,200)
FileListView2.SystemFileColor(93,174,124)
FileListView2.DefaultFileColor(145,157,58)
FileListView2.Font.Name(MS Sans Serif)
FileListView2.Font.Size(8)
FileListView2.Font.Style(fsNone)
FileListView2.EndUpdate

FileListView3.BeginUpdate
FileListView3.Color(40,75,59)
FileListView3.SortColumnColor(20,70,40)
FileListView3.FolderFileColor(22,201,4)
FileListView3.HiddenFileColor(191,198,200)
FileListView3.SystemFileColor(93,174,124)
FileListView3.DefaultFileColor(145,157,58)
FileListView3.Font.Name(MS Sans Serif)
FileListView3.Font.Size(8)
FileListView3.Font.Style(fsNone)
FileListView3.EndUpdate

FileListView4.BeginUpdate
FileListView4.Color(40,75,59)
FileListView4.SortColumnColor(20,70,40)
FileListView4.FolderFileColor(22,201,4)
FileListView4.HiddenFileColor(191,198,200)
FileListView4.SystemFileColor(93,174,124)
FileListView4.DefaultFileColor(145,157,58)
FileListView4.Font.Name(MS Sans Serif)
FileListView4.Font.Size(8)
FileListView4.Font.Style(fsNone)
FileListView4.EndUpdate


Including scripts in your FileCommander

To save scripts in FileCommander, you can add them as a tool. For details, see Tool list.