Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ajax

Pages: [1]
1
Support and Feedback / Re: How to transfer multi-scripts
« on: July 16, 2023, 04:31:15 »
Haven't yet used it much but that looks like just what I was hoping to find out.

Many thanks!

2
Support and Feedback / How to transfer multi-scripts
« on: July 15, 2023, 18:20:42 »
One of the things I like most about MC (multicommander) is the ability to create custom scripts.  I now have quite a few of them.  However, when I implement a new release of MC my scripts are gone.  This might have something to do with the fact that I prefer to use the portable versions of MC because this allows me to install and try the new version without making any change to the old ones that are working just fine.

It seems like there ought to be a simple way to transfer the scripts used in the prior (portable) versions of MC to the new one.  If such a capability exists I haven't been able to figure out how it works.  I have reviewed the documentation and even done some experimenting.

What is the simplest way to transfer (a lot) of custom scripts to a new installation of MC?

3
Script / Array as argument in Mulit-script functions
« on: April 12, 2022, 16:36:57 »
Do functions used in multi-script scripts (i.e., user commands) allow arrays to be passed as arguments?  If so, I can NOT find relevant documentation in Online Manual.  Might there be some kind of documentation, possibly examples, that demonstrate such methods?

I could provide screen shots that demonstrate a test that shows partial but NOT complete success if that might be helpful.

4
Script / How export/import multi scripts?
« on: April 11, 2022, 16:50:37 »
Export/import may NOT be the best choice of terminology for this question.  However, I've been using Multicommander (MC) for quite some time now and during that time I've developed quite a few of my own scripts.  I run MC (and just about all Windows applications) in portable fashion.  This technique allows for new releases to be installed separately without making any changes to old releases.  In that, reserve the ability to revert back to prior releases should there be something that doesn't seem to work quite right in the new release.  This concept would probably have similarities to the situation where a new release of MC is installed on another (i.e., test) computer.

It seems to me that there ought to be a simple way to transfer my scripts from one instance of MC to another.  Another idea would be to configure MC such that the scripts reside in some other directories external to the MC executable files and can be shared among several instances of MC.

Is this possible?  If so, how?  If not, is there a recommended method for facilitating this kind of migration?

5
I'd like to be able to select multiple files and then execute a command on all of them.  For example, suppose I want to set the read only attribute on all of the files in a particular folder.

I've tried using the "User Defined Commands" feature to create an external command.  For my example I tried the following:

attrib +R ${focusfilepath}

This seems to work but only on a single file no matter how many have been selected.

Is it possible that doing this requires the use of a multi-script command rather than external command?  I have been able to process multiple files with such a command but writing such a command seems like quite a lot of bother for something as simple as this example.

This seems like a very normal thing to want to do and one could imagine a lot of different examples where all we want is to execute a single Windows command on a batch of files.  Hope there is a simple way to do it!

6
Script / Is it possible to append text to a file?
« on: April 13, 2020, 17:47:12 »
I can use the echo command to append text to a file but thought such a script would be cleaner if I could do it using something like the "SaveStringToFile" command.  However, it seems "SaveStringToFile" does NOT allow text to be appended to a file.  This seems like a very normal/natural thing to do.  Given how sophisticated the Multicommander scripting capability is it would be surprising to find this can NOT be done.

I'm thinking that first using "LoadStringFromFile" and then appending to that string before running "SaveStringToFile" might work but this could become unwieldy as the size of the file grows and I'd opt to stick with echo.

I hoping someone can clue me in about what I've failed to figure out.

7
Many thanks, sorry for the trouble but that is a big help.

8
I'm a bit of a newbie with respect to MC.  Very much want to use dual panel capability to run scripts on folders/files located in one part of the file system that affect other parts of the file system.  In that, make selections in one pane (? source) and operate on selections in the other pane (? target).  With some difficulty I have been successful writing some such scripts but have now discovered that making source and target selections is something I have yet to figure how to do.

Have spent a good bit of time in the Online Documentation which I'd generally say is very impressive but have yet to find anything describing the notion of dual panels and how they relate to each other.  I'm guessing that this has something to do with the commonly used but, as best I've been able to find, undefined meaning of the terms "source" and "target".

Would be grateful if someone could either refer me to what I haven't been able to find or possibly offer a precise definition of what these terms mean with respect to MC.

9
Good to know.  Will do!

I also discovered that another technique that works is the following:

MC.Utils.CreateLink ASADMIN LNKTYPE=1 LNKTRG="{$filepath}" LNKSRC="{$linkpath^$linkname}"

Again.  Thanks for helping.  Multi Commander is very impressive!

10
Script / Re: Possible bug in Function StrTrimLeft()
« on: July 09, 2018, 15:51:20 »
I was able to revise my script so that it works fine without using StrTrimLeft.  Your clarification of its' purpose also makes it clear that it was not a good choice.  It just happened to work under some circumstances.

THANKS!  Sorry to trouble you.

11
Script / Possible bug in Function StrTrimLeft()
« on: July 08, 2018, 20:34:07 »
It looks like there may be a bug in function (StrTrimLeft) which I'm using to separate the file name extension from the remaining part of the file name.  For whatever it is worth the files I'm working with are images and a typical extension is .jpg.  I'm using the StrRFind function to locate the right most period (".") in the filename.  Then StrSub to obtain the portion of the filename that includes everything up to the period.  This all works as expected.

However, when I then use StrTrimLeft to obtain just the file name extension I get different results depending on how the filename is composed.  In my case, whenever the filename has only one period (".") that separates the extension from the rest of the filename I get the expected result.  For example, if the filename is "PartA.jpg" I get the extension as ".jpg".  However, if the file name where "PartA.PartB.jpg" I get the extension as "jpg".  In that, an extra period (".") character is being trimmed.  The same, incorrect result, seems to occur whenever the filename contains more than one period (".").

Following are a couple of lines of code that experience the problem -

@var $linkname = StrSub($filename, 0, StrRFind($filename, "."));
@var $linkext = StrTrimLeft($filename, $linkname);

12
OK!  Following is slight change per your suggestion which DOES work -

@var $linkpath = GetTargetPath();
@var $link = $linkpath + $linkname;
MC.Utils.CreateLink ASADMIN LNKTYPE=1 LNKTRG={$filepath} LNKSRC={$link}

which while good still leaves me a bit perplexed when it comes to why.

Above was done for purpose of testing limited change but I have also added the quotes you suggested and that seems to be no problem.  So, per your point is good.

Very grateful for your help.  Well done!

13
Making some progress but still hitting some snags.  Your suggestion about NOT using TagValues in multiscript is something I'm attempting to do.  Now that, I think, I've found the low level functions that do what I need I thought it would be good to change.  I believe this is also going to help with my desire to run scripts on multiple selections.  However I've experienced an anomaly that I cannot explain.

Following is a couple of lines of code that do NOT work -

@var $linkpath = GetTargetPath();
MC.Utils.CreateLink ASADMIN LNKTYPE=1 LNKTRG={$filepath} LNKSRC={$linkpath}\{$linkname}
 
However, if I change to the following it does work -

@var $linkpath = GetTargetPath();
MC.Utils.CreateLink ASADMIN LNKTYPE=1 LNKTRG={$filepath} LNKSRC=${targetpath}\{$linkname}   

Another curious point that is revealed in the debugger is that the value returned by GetTargetPath() and ${targetpath} are the same and both are strings that end with the backslash ('\') character.  However, if I remove the backslash ('\') character shown in the argument to LNKSRC that separates the 2 parts of the fully qualified path then it FAILS to work.  I would expect that after the variable substitution has occurred this would result in the double backslash ('\\') which I'd think does NOT belong there.


14
OK, I think I see what you mean.  However, this experience again demonstrates the need/desire to be able to test scripts that use this capability with the debugger.  When I code what is shown in your post and would have thought is correct for an array type variable (i.e., $arg[]) nothing happens which I've come to recognize as meaning there is error in the script.  When I looked closer I noticed that the "Google Search" example that you referenced actually codes it instead as "$arg()" which I found perplexing but went ahead and tried anyway.  That worked but then when I invoke the script form the command line but without an argument it fails.  Is there a suggested method for writing a script that can figure out whether or not arguments have been specified on the invoking command?  Might there be an explanation for the alternative syntax used on the $arg variable?

15
It looks like the problem invoking the multiscript using an alias was attributed to a coding error.  In that, the script probably did execute but when nothing appeared to happen this was not apparent.  However now that I can confirm that it is invoked I'm having trouble picking up the value entered for a parameter.

As requested the script follows:
Code: [Select]
@var $suffix = GetTagValue("${param:0}");
@var $message = "Request to Create a Hard Link (Alias)";
$message += "\nParam0=" + $suffix;
if(StrLen($suffix) <= 0)
{
$suffix = "L1";
}
else if (StrLen($suffix) > 5)
{
$suffix = "L9";
}
@var $filename = GetTagValue("${sourcefocusname}");
@var $linkname = StrSub($filename, 0, StrRFind($filename, "."));
@var $linkext = StrTrimLeft($filename, $linkname);
$linkname += "." + $suffix + $linkext;
@var $linkpath = GetTagValue("${targetpath}");
$message += "\nLinkPath=" + $linkpath;
$message += "\nLinkName=" + $linkname;
@var $tofile = GetTagValue("${sourcefocuspath}");
$message += "\nToFile=" + $tofile;
@var $result = MessageBox("Alias Make", $message, 1);
if($result == 1)
{
MC.Utils.CreateLink ASADMIN LNKTYPE=1 LNKTRG=${sourcefocuspath} LNKSRC=${targetpath}\{$linkname}
}
As you can see I'm assuming the parameter value is string (type of data).  Because I'm uncertain about this I tried using some of the functions described http://multicommander.com/docs/multiscript/corefunctions but this produced an error in the debugger saying that no such function existed.

Right now it looks like my only problem is how to find the value entered as a parameter on the command line.

16
In my case the Alias Manager screen lists the name I assigned to the multiscript on the left and a value of @d037fc176448408cb5c744d5bc62ae33 on the right.  That value is what is displayed as the "Unique ID" in the upper right corner of the script editor for the script I want to invoke.

The script works fine in Multicript Debugger but it looks to me as if you cannot test the parameter passing in the debugger.  If that is possible I could use some help figuring out how to do that.  I'm not even able to invoke it without a parameter from the command line.

17
Finally succeeded to get a simple script to work.  Never did figure out what was wrong with prior attempts but a bit of trial and error succeeded.  Now I'd like to figure out how to pass a parameter when invoking the script.  From documentation it looks like this means the script must be launched from the command line but there must be some not so obvious secret to making this work.

I chose the "Alias" button when using "Configuration>User Defined Commands" to create a multiscript.  There is an entry that shows up in the panel displayed when selecting "Configuration>Manage Aliases".  However, nothing seems to happen when the alias name is entered on the command line.

What do I need to do now?

18
Script / Re: How to run script on multiple files?
« on: July 05, 2018, 16:23:13 »
It depend on what type.. If it us MultiScript you have full control. To get any files you want

If it is CustomCommand.. then you can in the option to check.. (But that only for if files being dropped, else you ned to call a custom command from multiscript. However it depends on what you are doing. The custom Command can interact with the UI and cause issues if you run multiple command in a row without letting it catch up
My experience with MC is quite limited but it looks to me like Multiscript invariably adds some capability which is desirable.  Therefore, I'm always leaning toward using Multiscript.

19
Script / Re: How to run script on multiple files?
« on: July 05, 2018, 16:19:16 »
Take a look here:

http://forum.multicommander.com/forum/index.php/topic,1472.msg5305.html#msg5305

Thanks!  Looks like I need to spend some time studying but, at first glance, that looks like what I'm after.

20
Script / How to run script on multiple files?
« on: July 04, 2018, 22:32:12 »
Is it possible to execute a script all of the files in a selection list?  If so how?

21
Still trying to do what provoked a previous post (http://forum.multicommander.com/forum/index.php/topic,2212.0.html) but am past the documentation stage.  The MultiScript debugger does some nice things but even using it success is quite illusive.  Here are some suggestions which I think would make the debugger much more useful.

  • Need to be able to copy text from the panel that displays values, that the variables get set to, which can then be pasted elsewhere.
  • Before executing one of the MC.xxx commands that command needs to be expanded (i.e., variable substitution completed) and then displayed prior to being executed.

Based on inspection of variable values my scripts work correctly but something bad is happening when MC.xxx commands are invoked.

A minor suggestion would be to add a horizontal scroll bar to the panel used for outputting debugger results.  Even on my wide screen display the values are often out of view.

22
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?

23
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};

24
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?

25
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.

Pages: [1]