Multi Commander Support Forum
Multi Commander => Script => Topic started by: karthik on March 27, 2015, 10:44:12
-
Hello, I want to get the path name in the source panel and replace the drive letter in it and open the result in target panel.
For example, in source panel I have the following path Y:\Projects, I want to open the directory P:\Projects in the target panel. I tried writing a script but doesn't work.
Script:
@var $path = GetSourcePath();
@var $str = StrReplace($path, "Y:" , "P:");
MC.Explorer.Goto PATH=$str
I see that $str has the path P:\Projects but MC.Explorer command does not execute properly. Also, how can I ask MC.Explorer.Goto to open this window in the target panel instead of source panel.
Thanks.
-
That is because you are mixing two script types..
MC.Explorer.Goto is a custom command and not a MultiScript command.
Custom command are simple one line commands.
MultiScript Scripts can call CustomCommand but custom command does not know what variables like $str is.. they need to be encapsulated with {} , then they will be evaluated before the command is executed.
@var $path = GetSourcePath();
@var $str = StrReplace($path, "Y:" , "P:");
MC.Explorer.Goto PATH={$str}
-
Thanks for the clarity. That helps. Another follow up question: Is there a way I can open it in the target panel instead of the source panel?
-
http://multicommander.com/docs/customcommands_list#mc.explorer.goto
You can use LEFT/RIGHT/SOURCE/TARGET instead of PATH to target specific panels.
-
I tried the TARGET tag and it worked. Is there a way I can make it appear in a "NEW" target tab instead of replacing a older one?
-
http://multicommander.com/docs/customcommands_list#mc.explorer.newbrowser