Automation Plugin

Support for developers of new plugins, third-party plugin announcements and discussions.
Petr Solin
ALTAP Staff
ALTAP Staff
Posts: 1109
Joined: 08 Dec 2005, 09:13
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Plugin

Post by Petr Solin » 03 Dec 2009, 13:22

Another suggestion: enumerating files and directories even from subdirectories (now only from panel). Salamander has method CSalamanderGeneralAbstract::CallPluginOperationFromDisk (it works only for disk paths in panel) which does whole enumeration, so maybe it would not be so time consuming to implement. ;-)

If you add this, it would be possible to do file lists including subdirectories, etc.

manison
Plugin Developer
Plugin Developer
Posts: 210
Joined: 09 Dec 2005, 23:23
Location: Ceske Budejovice, Czech Republic
Contact:

Re: Automation Plugin

Post by manison » 03 Dec 2009, 13:35

Interesting, I will take a look at it. Thanks.

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5196
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Plugin

Post by Jan Rysavy » 31 Dec 2009, 01:03

Manison, I'm working on JScript for recursive image conversion using ImageMagick.

I found one problem, I'm unable to call WScript object:

Code: Select all

WScript.Sleep(1000);
WScript.Echo("Done");
I get following error:

Code: Select all

---------------------------
Salamander Automation Script Error
---------------------------
Line: 1

Column: 1

Error: 'WScript' is undefined
---------------------------
[OK]
---------------------------
Is it OK? As standalone .js executed from shell it works fine. Please advise.

Edit: Probably the same problem: http://www.coderanch.com/t/112833/HTML- ... ers#567194
Edit2: It's probably not implemented by Automation plugin. Is there some way how to call Sleep() or Quit() methods? Could it be published by Salamander (root) object? It would be also great to get interface version from Salamander object so we can solve compatibility issues on script side (for example test minimal interface version).

manison
Plugin Developer
Plugin Developer
Posts: 210
Joined: 09 Dec 2005, 23:23
Location: Ceske Budejovice, Czech Republic
Contact:

Re: Automation Plugin

Post by manison » 31 Dec 2009, 11:06

Jan Rysavy wrote:It's probably not implemented by Automation plugin.
Exactly. The WScript object is the root object for the Windows Script Host (wscript.exe or cscript.exe). The root object for the Automation plugin is the Salamander object.
Jan Rysavy wrote:Is there some way how to call Sleep() or Quit() methods? Could it be published by Salamander (root) object?
Sure. However, regarding the Sleep method, since the Automation plugin runs on the main thread, the whole UI would be blocked. What is the Sleep supposed to be used for?
Jan Rysavy wrote:It would be also great to get interface version from Salamander object so we can solve compatibility issues on script side (for example test minimal interface version).
Have you checked the Salamander.Version property? It has the same value as the SalamanderVersion global plugin variable.

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5196
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Plugin

Post by Jan Rysavy » 31 Dec 2009, 11:51

manison wrote:
Jan Rysavy wrote:Is there some way how to call Sleep() or Quit() methods? Could it be published by Salamander (root) object?
Sure. However, regarding the Sleep method, since the Automation plugin runs on the main thread, the whole UI would be blocked. What is the Sleep supposed to be used for?
I have some troubles with NTFS file system (Windows 7 x64). I'm deleting directory tree in destination and re-creating it immediately. When one of deleted directories is displayed in Salamander panel, I will get Access Denied error while re-creating phase (so directory is deleted and cannot be immediately created again). I wanted to try call sleep as dirty hack. Maybe we should publish methods to temporarily release Salamander file system change notifications (I will talk about it with Petr). The main thread is not a problem for me.
manison wrote:
Jan Rysavy wrote:It would be also great to get interface version from Salamander object so we can solve compatibility issues on script side (for example test minimal interface version).
Have you checked the Salamander.Version property? It has the same value as the SalamanderVersion global plugin variable.
I mean version of Automation plugin API, is it available for scripts? So we can display message like "This script needs Automation plugin ver. XYZ and later"?

manison
Plugin Developer
Plugin Developer
Posts: 210
Joined: 09 Dec 2005, 23:23
Location: Ceske Budejovice, Czech Republic
Contact:

Re: Automation Plugin

Post by manison » 31 Dec 2009, 12:14

Jan Rysavy wrote:
manison wrote:
Jan Rysavy wrote:Is there some way how to call Sleep() or Quit() methods? Could it be published by Salamander (root) object?
Sure. However, regarding the Sleep method, since the Automation plugin runs on the main thread, the whole UI would be blocked. What is the Sleep supposed to be used for?
I have some troubles with NTFS file system (Windows 7 x64). I'm deleting directory tree in destination and re-creating it immediately. When one of deleted directories is displayed in Salamander panel, I will get Access Denied error while re-creating phase (so directory is deleted and cannot be immediately created again). I wanted to try call sleep as dirty hack. Maybe we should publish methods to temporarily release Salamander file system change notifications (I will talk about it with Petr). The main thread is not a problem for me.
Ok, I will add the Sleep method to the interface.
Jan Rysavy wrote:
manison wrote:
Jan Rysavy wrote:It would be also great to get interface version from Salamander object so we can solve compatibility issues on script side (for example test minimal interface version).
Have you checked the Salamander.Version property? It has the same value as the SalamanderVersion global plugin variable.
I mean version of Automation plugin API, is it available for scripts? So we can display message like "This script needs Automation plugin ver. XYZ and later"?
Oh, I see now. Beginning the next version there will be the AutomationVersion property of the Salamander object.

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5196
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Automation Plugin

Post by Jan Rysavy » 31 Dec 2009, 15:59

Thank you. I have some ideas from my yesterday's trials.

Small bug:
Automation doesn't display error message box when script could not be executed (was removed for example). It does nothing which could be misleading.

Some ideas:
New "Rescan" command to refresh cached script names. Now we must unload/reload Automation plugin? Another option could be refresh before Automation menu is displayed?

Add support for TRACE_I and TRACE_E messages so we can log traces from scripts. From next Preview Build Salamander version will be Trace Server part of default installation (for PB only, not for final version). Logging directly to text will be also supported trough the same TRACE_I / TRACE_E interface.

Option to focus item in panel so we can point out to created archive or another desired file.

Last one: It would be great to have Progress dialog box (CSalamanderForOperationsAbstract) availabe so we can display operation progress and handle Cancel button.

Automation plugin looks really great. I see big potential here...

manison
Plugin Developer
Plugin Developer
Posts: 210
Joined: 09 Dec 2005, 23:23
Location: Ceske Budejovice, Czech Republic
Contact:

Re: Automation Plugin

Post by manison » 04 Jan 2010, 19:08

Jan Rysavy wrote:Small bug:
Automation doesn't display error message box when script could not be executed (was removed for example). It does nothing which could be misleading.
Thanks, I'll take a look.
Jan Rysavy wrote:Some ideas:
New "Rescan" command to refresh cached script names. Now we must unload/reload Automation plugin? Another option could be refresh before Automation menu is displayed?
Is it possible to modify the contents of the plugin menu with the current plugin interface? I don't see another way but the CPluginInterfaceAbstract::Connect method.
Jan Rysavy wrote:Add support for TRACE_I and TRACE_E messages so we can log traces from scripts. From next Preview Build Salamander version will be Trace Server part of default installation (for PB only, not for final version). Logging directly to text will be also supported trough the same TRACE_I / TRACE_E interface.
That should be easy, putting on my to do list.
Jan Rysavy wrote:Option to focus item in panel so we can point out to created archive or another desired file.
To focus a file you can set the Path property of the appropriate Panel object. For example (jscript):

Code: Select all

Salamander.SourcePanel.Path = "C:\\autoexec.bat";
This internally invokes SalamanderGeneral->ChangePanelPath. However setting path in the target panel will not make it active. It does not seem to be possible to activate a panel through the current version of the plugin interface, is it?
Jan Rysavy wrote:Last one: It would be great to have Progress dialog box (CSalamanderForOperationsAbstract) availabe so we can display operation progress and handle Cancel button.
Agreed, putting on the to do list.
Jan Rysavy wrote:Automation plugin looks really great. I see big potential here...
Thank you!

Locked