Multi Commander Support Forum

Multi Commander => Support and Feedback => Topic started by: total_annihilation00 on January 15, 2025, 14:30:13

Title: MultiTag for Opening Current Focus *FileName* Only /w a Program
Post by: total_annihilation00 on January 15, 2025, 14:30:13
I need the MultiTag to open the currently selected file (via Custom Menu) to the app, without the path, only the filename without the extension even, and certainly not the full filepath. When I enter this in MSDOS it works: "C:\Users\dell\Documents\fba64_029743\fba64.exe garou" (without quotes) but in MultiCommander I tried both variants of ${focusfilepath}: ${focusfilename} (returns only the name of the file that is currently in focus, without its path) and ${focusfile} (identifier to return the filename with its extension) but they both don't work (I'am entering these as a User Defined Command (External Command) into Custom Menu so I can right-click a file & open the game ROM selected in the FB Alpha program, as a command-line parameter (it accepts filenames only, w/o path and extension.) Please help me find the right MultiTag/identifier for this.
Title: Re: MultiTag for Opening Current Focus *FileName* Only /w a Program
Post by: Jungle on January 15, 2025, 14:58:30
If I get you right, you might need MultiScript function PathGetNamePart (https://multicommander.com/Docs/multiscript/functions/filesystem#pathgetnamepart)
Title: Re: MultiTag for Opening Current Focus *FileName* Only /w a Program
Post by: Mathias (Author) on January 15, 2025, 15:01:06
Use MultiScript instead of external. then you can manipulate the path and change what you want

For multiscript you have PathGetNamePart(..) that can return filename without extension.
Title: Re: MultiTag for Opening Current Focus *FileName* Only /w a Program
Post by: Mathias (Author) on January 15, 2025, 15:04:14
Something like
Code: [Select]
@var $file = GetSourceFocusPath();
$file = PathGetNamePart($file, 1);

MC.Run CMD="C:\ExeToRun.exe" ARG="{$file}"
Title: Re: MultiTag for Opening Current Focus *FileName* Only /w a Program
Post by: total_annihilation00 on January 15, 2025, 15:29:47
Thanks, I got it to work thanks to both of your help. AI helped write the MultiScript:

Code: [Select]
@var $name = PathGetNamePart( GetSourceFocusPath(), 1 );
MC.Run CMD="C:\\Users\\dell\\Documents\\fba64_029743\\fba64.exe" ARG="{$name} -r 1366x768x32"