Page 1 of 1

Automation documentation for MakeDir

Posted: 19 Jun 2011, 19:01
by slaurel
Hi,

I've read through the same scripts included with the Automation plugin, and I've downloaded and browsed the Salamander SDK as well. I'm having trouble finding a starting point for writing a simple script, and I'd appreciate a pointer to any existing documentation I've missed.

There are a number of file sorting tasks that I do repeatedly while cleaning up a filesystem, which are really just simple sequences of Salamander commands. Here's an example:

Select a list of files/dirs, create a new subdir (let's say in the current dir for now), and move the selected items into it.

There are lots of examples in the Automation scripts around handling the current selection, saving the selection, or putting it in a variable...

What I can't find are examples of:
Firing off a Salamander command like MakeDir - letting Salamander prompt the user for the dirname, and capturing it (it's the currentitem after the MakeDir, so that shouldn't be difficult)
OR, prompting a user for a value, using that to do the MakeDir.

What's the link that I'm missing between Javascript in Automation, and a comprehensive list of Salamander objects/methods that can be accessed?

Thank you.

Re: Automation documentation for MakeDir

Posted: 20 Jun 2011, 05:56
by Jan Rysavy
Automation plugin has relatively basic interface for Altap Salamander functions. It may be what you are missing - there is not support for calling Salamander internal commands such as MakeDir, CopyFiles, PackFiles, etc. For now you need to execute such commands using JS and objects such as WScript.Shell or Scripting.FileSystemObject.

Please open Altap Salamander (2.54) menu Help > Contents, look at Plugins > Automation section and read provided help pages.

For MakeDir command see sample Make Link.js (provided as Automation sample script). There is dialog box with name prompt and some options.
To create directory you need to call:

Code: Select all

    objFSO = new ActiveXObject("Scripting.FileSystemObject");
    ...
    try
    {
      if (!objFSO.FolderExists(path))
        objFSO.CreateFolder(path);
    }
    catch (err)
    {
      LogWrite("Cannot create directory " + path + ". Error: " + err.description);
    }
Don't hesitate to ask if you have any questions :)