Page 1 of 1

Custom File Associations: Multiple applications per single pattern

Posted: 19 Jul 2022 10:15
by John_C
Is it possible somehow to specify multiple applications per single pattern?

Here is what I mean:

Code: Select all

html>Sublime Text;Chrome
or maybe
htm;html>Sublime Text;Chrome

Sublime Text to edit, Chrome to preview
The idea is that when you double-click the file (or press the Enter key instead), you will be promted which one of the specified applications to use.

Re: Custom File Associations: Multiple applications per single pattern

Posted: 19 Jul 2022 10:42
by highend
Sure, e.g. use a script instead that let's you select the application from a popup menu...

Re: Custom File Associations: Multiple applications per single pattern

Posted: 19 Jul 2022 12:31
by RalphM
What you describe is somewhat the standard behavior of CFA's.
You can set one default application for each extension (or group of extensions) which is used on enter or dbl-click, all further (non-default) entries for the same extensions are shown in the CFA menu (button or Ctrl+Alt+Enter) to choose from.

Re: Custom File Associations: Multiple applications per single pattern

Posted: 09 Aug 2022 03:06
by John_C
highend wrote: 19 Jul 2022 10:42 Sure, e.g. use a script instead that let's you select the application from a popup menu...
Could you provide some help with this script? I simply don't understand what is the starting point to create it...

Re: Custom File Associations: Multiple applications per single pattern

Posted: 09 Aug 2022 07:43
by highend

Code: Select all

    $apps = <<<>>>
Sublime Text|{your path to sublime text.exe}
Chrome|{your path to chrome.exe}
    >>>;
    $apps = regexreplace($apps, "^(.+?\|)(.+?)(?=\r?\n|$)", "$1$2|$2");

    $sel = popupmenu($apps, 6:=<crlf>, 7:="|");
    if ($sel) { run lax("$sel" "<pfaitem>"); }
htm;html>::load "{name of the script.xys}";