News:

MultiCommander v16.6 is released!

Main Menu

get path name and replace drive and open in target panel

Started by karthik, March 27, 2015, 10:44:12

Previous topic - Next topic

karthik

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.

Mathias (Author)

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}



karthik

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?

Mathias (Author)


karthik

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?