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

PaulJayD

  • Newbie
  • *
  • Posts: 3
    • View Profile
[SOLVED] Start MC with folder and specific file HIGHLIGHTED
« on: September 30, 2022, 15:20:17 »
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 previously-selected 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:47:05 by PaulJayD »