My current code:
MCParams := '-AutoRun="SelectFile"';
ShellExecute(0, 'open', PChar(MC_PATH), PChar(MCParams), nil, SW_SHOWNORMAL);
##########################################
#Name:SelectFile
#Type:multiscript
#ID:3dc58130a89d422c841855e79ab4c6bd
#Desc:File Selection
#Options:
##########################################
@var $TmpPath = TranslateEnvString("%temp%") + "\MC_PARAM.tmp";
@var $FileContent;
@var $DirectoryPath;
@var $SelectedFile;
if(FileExists($TmpPath) == 1)
{
$FileContent = LoadStringFromFile($TmpPath);
@var $Lines = StrSplit($FileContent, "\r\n");
$DirectoryPath = $Lines[0];
$SelectedFile = $Lines[1];
DeleteFile($TmpPath, "NODIALOG, SILENT, NOPROGRESS");
#@var $text = "TEMP: " + $TmpPath + "\n" + "DIR: " + $DirectoryPath + "\n" + "FILE: " + $SelectedFile;
#MessageBox("PARAMS", $text, 0);
MC.SetActivePanel PANEL=RIGHT
MC.Explorer.Goto PATH="{$DirectoryPath}"
MC.Explorer.SetItemFocus ITEM="{$SelectedFile}"
}
else
{
MessageBox("Error!", "Parameters not found!", 0);
}
So, I run MC with autorun parameter and save into temp a file with directory path and file name.
Script is reading this temp file, deleting it and set right panel with our directory path.
STILL selecting a file NOT WORKING!
Edit: Sometimes works, when adding Sleep and SetSourceSelected()
Sleep(500);
MC.Explorer.SetItemFocus ITEM="{$SelectedFile}"
@var $arr[] = {$SelectedFile};
SetSourceSelected($arr, 1);
But, there must be better way... @Mathias (Author) ?
-Pawel