11
Support and Feedback / Re: Run MC with parameters to select file in specified folder
« Last post by Pawel on June 19, 2026, 13:04:56 »This MC command line works
MCParams := Format('-AutoRun="SelectFile" "%s" "%s"', [MCDirectory, MCFileName]);
ShellExecute(0, 'open', PChar(MC_PATH), PChar(MCParams), nil, SW_SHOWNORMAL);
Script (SelectFile) is called.
For now I am not trying to select RIGHT PANEL and select file.
The problem is PARAMETERS. I am passing -AutoRun, and 2 others (Dir path and File name)
But, I have no idea how to display param 0 and param 1 values
This should work - but I got empty strings:
##########################################
#Name:SelectFile
#Type:multiscript
#ID:3dc58130a89d422c841855e79ab4c6bd
#Desc:File Selection
#Options:
##########################################
@var $DirectoryPath = ${param:0};
@var $SelectedFile = ${param:1};
@var $msg0 = "DIR : " + {$DirectoryPath};
@var $msg1 = "FILE : " + {$SelectedFile};
MessageBox("PARAM, $msg0, 0);
MessageBox("PARAM, $msg1, 0);
MessageBox shows empty string... so, the first problem is here... detecting parameters
The problem must be in command line - either MC not support -AutoRun<script> with other parameters or I pass other parameters in wrong way...
-Pawel
MCParams := Format('-AutoRun="SelectFile" "%s" "%s"', [MCDirectory, MCFileName]);
ShellExecute(0, 'open', PChar(MC_PATH), PChar(MCParams), nil, SW_SHOWNORMAL);
Script (SelectFile) is called.
For now I am not trying to select RIGHT PANEL and select file.
The problem is PARAMETERS. I am passing -AutoRun, and 2 others (Dir path and File name)
But, I have no idea how to display param 0 and param 1 values
This should work - but I got empty strings:
##########################################
#Name:SelectFile
#Type:multiscript
#ID:3dc58130a89d422c841855e79ab4c6bd
#Desc:File Selection
#Options:
##########################################
@var $DirectoryPath = ${param:0};
@var $SelectedFile = ${param:1};
@var $msg0 = "DIR : " + {$DirectoryPath};
@var $msg1 = "FILE : " + {$SelectedFile};
MessageBox("PARAM, $msg0, 0);
MessageBox("PARAM, $msg1, 0);
MessageBox shows empty string... so, the first problem is here... detecting parameters
The problem must be in command line - either MC not support -AutoRun<script> with other parameters or I pass other parameters in wrong way...
-Pawel
Recent Posts