Author Topic: Need more documentation when creating/testing user defined commands  (Read 38719 times)

ajax

  • Junior Member
  • **
  • Posts: 25
    • View Profile
The significant capability of Multi Commander that captured my interest is the ability to create and use user defined commands/scripts.  Thought I was doing pretty good on my first one until trying to run it and finding that it failed.

I was able to find the log files which contained error codes but absent some explanation of what they mean they are pretty useless.  Is there a reference that would solve such problem?

Likewise, the procedure for creating a "Custom Command" is nicely documented but lacking some necessary details.  It appears as though my intuitive attempt to specify function arguments must have gotten it wrong.  A bit a trial and error hacking didn't overcome the problem.  Some elaboration on the meaning of these parameters also seems necessary for this to be an effective tool.

While the documentation for Multi Commander overall appears to be very nice the shortcomings mentioned above happen to be critical to my finding the use of Multi Commander to be worthwhile.

AlanJB

  • VIP Member
  • *****
  • Posts: 436
  • VERY old Programmer
    • View Profile
Have you used the MultiScript debugger at  Menu -> Help -> MultiScript Debugger ?

And looked at the documentation at http://multicommander.com/docs/multiscript/ and subsections ?

ajax

  • Junior Member
  • **
  • Posts: 25
    • View Profile
No!

My interpretation based on reading the documentation is that MultiScript is not what I was trying to do.  What I thought I was doing is called Custom Command.

When I, now, open MultiScript Debugger it seems to know about the 2 built in commands.  One appears to be MultiScript (Google Search) the other External (Play M3U in folder).  Not sure why my command is not listed.

Thought to copy and paste from Configuration>User Defined Commands, then selected (Run) arrow, then selected stepover (ICON).  Messages indicate started and attached (actually spelled as "attched") but no error reported and nothing seems to have happened.  The file operations log contains the same error.

How are we supposed to interpret those errors?

AlanJB

  • VIP Member
  • *****
  • Posts: 436
  • VERY old Programmer
    • View Profile
Ah — my bad, sorry — I missed "Custom Command".  Obviously the MultiScript Debugger will not help.

There is a list of Custom Commands with their purpose and parameters here:

http://multicommander.com/docs/customcommands_list

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
The significant capability of Multi Commander that captured my interest is the ability to create and use user defined commands/scripts.  Thought I was doing pretty good on my first one until trying to run it and finding that it failed.

I was able to find the log files which contained error codes but absent some explanation of what they mean they are pretty useless.  Is there a reference that would solve such problem?

Likewise, the procedure for creating a "Custom Command" is nicely documented but lacking some necessary details.  It appears as though my intuitive attempt to specify function arguments must have gotten it wrong.  A bit a trial and error hacking didn't overcome the problem.  Some elaboration on the meaning of these parameters also seems necessary for this to be an effective tool.

While the documentation for Multi Commander overall appears to be very nice the shortcomings mentioned above happen to be critical to my finding the use of Multi Commander to be worthwhile.

Yes documentation is lacking. Unfortunately it is a very time consuming to write. And becuse of my limited time I have to choose if I want to add features and fix bug or update documentation. and it often falls on code.

If you use MultiScript there is a debugger that run script line by line.. (As mention above)
The documentationfor "Custom commands" is very well documented I think. and if you use the built in editor for that you see a short description text for what each paramters is doing too.

If you can give me a specific example that is lacking I will se if I can add it. Or just ask in the forum if you have any issues

ajax

  • Junior Member
  • **
  • Posts: 25
    • View Profile
Actually the documentation is quite impressive.  Of course that's coming from someone with only a few days of using it.  My question had to do with error codes.  It's hard to imagine that they aren't listed (written down) somewhere/somehow.

Anyway, I went a little further and decided that MultiScripts could be good and my most immediate objective would need some such capability.  Therefore, I developed a fairly simple script, documentation very helpful, and using the Multi Script Debugger, which is nice, had some good success doing the basic debugging.  The basic purpose of the script is to tailor the arguments to be used to call a custom command.  Everything seems to be correct according to the debugger.

Is it possible that the custom commands are NOT supposed to do anything when invoked by the debugger?  That would explain the apparent result I'm getting.

The code follows (absent any attempt at handling the mentioned parameter).  It works as intended until the last line which invokes the MC.Utils.CreateLink custom command, which does nothing that I can recognize other than add a variable named $__CMDRESULT that appears to be an empty string.
Code: [Select]
// Script to create a hard link (HL) to the source file (left panel selection),
// the link is placed in the target folder (right panel selection),
// the name of the link is the same as the source file name except for the addition of a suffix
// used to indicate that this directory entry is a hard link.  The suffix which can be specified
// by passing a parameter to this script which defaults to "L1" when the script is called without
// using a parameter.  This suffix is placed just before the file name extension, which must
// exist, and is preceded by a Period (".") as a separator character.

@var $suffix = "L1";
@var $filepath = GetTagValue("${sourcefocuspath}");
@var $filename = GetTagValue("${sourcefocusname}");
@var $linkdir = GetTagValue("${targetpath}");
@var $linkname = StrSub($filename, 0, StrRFind($filename, "."));
@var $linkext = StrTrimLeft($filename, $linkname);
$linkname += ".";
$linkname += $suffix;

// Full path to link being created
@var $target = $linkdir + $linkname + $linkext;
// Arguments for createlink command to be executed
@var $cmdargs = "ASADMIN LNKTYPE=1 LNKTRG=" + $filepath;
$cmdargs += " LNKSRC=" + $target;

//@var $result = MessageBox("MC.Utils.Createlink", $cmdargs, 0);
MC.Utils.Createlink {$cmdargs};
« Last Edit: June 27, 2018, 04:25:35 by ajax »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
Only MultiScript support error handling. CustomCommand do not have much of error handling since they are more like Fire and Forget commands that are sent from the UI Layer. (They are like in if press the UI button for the command but specific some default parameters)
MultiScript functions are more core, and are not sent from the UI layer. and there is more control over these.  these are more low level.
But MultiScritp can call CustomCommands.. but they are fire and forget.. and if the CC is starting something that is handled in the background, the script will continue without waiting.


CreateLink  ( http://multicommander.com/docs/customcommands_list#mc.utils.createlink )
If you have space in file names you might need to put " around them.

MC.Utils.Createlink ASADMIN LINKTYPE=1 LNKTRG="{$filepath}" LNKSRC="{$target}"


« Last Edit: June 27, 2018, 07:43:51 by Mathias (Author) »

ajax

  • Junior Member
  • **
  • Posts: 25
    • View Profile
I assume that when you say "space in file name" you are talking about a blank character such as in "My Documents".  Because of this kind of problem I make a particular point of NOT using the blank character when naming files.  I substituted the following line both with and without quotes with NO difference in result.

MC.Utils.CreateLink ASADMIN LINKTYPE=1 LNKTRG={$filepath} LNKSRC={$target}

I also tried the following line all by itself in the Multi Debugger and it works as expected.

MC.Utils.CreateLink ASADMIN LNKTYPE=1 LNKTRG=${sourcefocuspath} LNKSRC=${targetpath}\${sourcefocusname}

which, I think, answers my question about whether or not custom commands function normally when using the Multi Debugger.

Because of what you describe as "Fire and Forget" I'd probably much prefer to use lower level functions but have not been able to identify, using documentation, one to use for creating a hard link.

Is it possible that such a function exists only missing from documentation?

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
It is blank space in the entire path.  But it should not be a problem.. Just make sure you got " around the it like in my example


Running it in the debugger will not give you anything since they are not MultiScript function..  they are CustomCommand.. (Multiscript can execute CustomCommand..  but there is no extra info that is can show about them)

Fire and forget is when you fire a command and then the program continues. without knowing what happens or when it is finished. It just fire it off without waiting for it to complete