Author Topic: [SOLVED] Start MC with folder and file HIGHLIGHTED ??  (Read 4902 times)

PaulJayD

  • Newbie
  • *
  • Posts: 3
    • View Profile
[SOLVED] Start MC with folder and file HIGHLIGHTED ??
« on: September 09, 2022, 03:46:59 »
Is there a way to start MC with a folder name and specific file within that folder to automatically select when the Explorer panel opens?

Addendum:
What I meant to query:
Is there a way to start MC with a folder and specific file HIGHLIGHTED ??
I want my user to be able to quickly locate a file within a directory.

[ SOLVED ] ==========================================================

I have a facility that presents a file (selected from Windows Explorer
via the context menu) in Multi Commander's Left panel directory listing,
with another "target directory" in the Right panel.

The problem was that once selected, I needed to keep the user's focus
on the file: It was not easily visible once the file's owning directory
was listed.
The solution I found is as follows:

Just prior to executing MC, my Windows batch file executes:

   set xShareFileId=%srcFile%

This sets the Environment variable with the file's drive:\path\name.

Then, the batch files executes MC with the additional operand:

   -AutoRun=xShareFileId

And, within MC, the "xShareFileId" script has been coded as follow:

   #
   # xShareFileid - Highlight specified file (from batch file)
   #
   # get fileid from environment
   @var $xShareFileId = TranslateEnvString("%xShareFileId%");

   # get drive, fullPath, filename
   @var $fileInfo[] = PathGetParts( $xShareFileId );
   @var $source = $fileInfo[1];
   @var $fileName = $fileInfo[2];

   # list directory, with file hilighted
   MC.Explorer.Goto LEFT={$source} ITEMFOCUS={$fileName}
         
Hope some of you find this useful,
PaulJayD
« Last Edit: October 03, 2022, 00:49:50 by PaulJayD »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4271
    • View Profile
    • Multi Commander
Re: Start MC with folder and file to select
« Reply #1 on: September 09, 2022, 07:33:30 »
Look at http://multicommander.com/docs/commandlineparameters

There are multiple way depending on configuration..

Just as paramters or -L / -R parameters if you open new instance.
or /OPEN parameter if you want to modify a currently running instance.