CFA: Make Generic File Types configurable

Features wanted...
Post Reply
Garonne
Posts: 195
Joined: 21 Apr 2015 19:10
Location: Win11, 100% Scaling
Contact:

CFA: Make Generic File Types configurable

Post by Garonne »

I want to use the generic File Type {:Text} within CFA-definitions, but i don't want it to match html Files (and variant extensions). Reading the docs I thought I could configure those in "Options|Previewed Formats", but - though I clearly unticked (x)htm(l) files in the configuration - they still do match for CFA definitions.

Could you please correct that (or give us some other means to change that behavior)?

Actually, giving this a config section on it's own would allow for defining user-added file type groups as well... (Just a thought...)

highend
Posts: 14925
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: CFA: Make Generic File Types configurable

Post by highend »

Atm you could just use a * CFA entry and load a script which then modifies a GFT on the fly and chooses the necessary action

E.g.:

Code: Select all

$gft = regexreplace(get("genericfiletype", "{:Text}", ";"), "\*\.(x?html?);");
One of my scripts helped you out? Please donate via Paypal

jupe
Posts: 3446
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: CFA: Make Generic File Types configurable

Post by jupe »

I apologize for replying before admin (Don) has had a chance, but technically you already have the ability to create your own custom categories, using your example criteria just list the extensions you want and exclude the ones you don't. If you don't want to manually write or copy/paste for each CFA entry all the extensions then you can instead get the default list's in the required format with this script:

text get("genericfiletype", "{:Text}", ";");

then just add them to your required CFA entries, alternatively, if you add the extensions as an Alias, you can use them in the CFA dialog without listing them all for each app repetitively, like so:

"Text Category App" <get alias Text>>c:\whatever.exe

How to add an alias you may ask? For example, to add "Text" as an alias just enter the below text in the XY addressbar (after your required mods!):

Code: Select all

@Text=accurip;adml;admx;ahk;asc;asp;aspx;au3;b64;bas;bat;c;htaccess;cer;cfg;cmd;cls;conf;config;cnt;ctl;cpp;crt;cs;css;csv;cws;cue;dat;eml;filters;frm;h;hpp;htc;ics;idl;inc;inf;ini;java;js;json;less;lng;log;lrc;lst;lua;m3u;m3u8;manifest;man;map;markdown;md;mht;mhtm;mhtml;mim;mk;msg;nfo;nsi;nws;odl;opml;php;pl;prj;py;pyw;rc;rdf;reg;resx;rst;scss;sh;sln;sql;srt;tbl;txt;uue;url;utf8;vb;vbp;vbs;vbw;vcf;website;wer;wpl;ws;xml;xsd;xsl;xslt;xxe
Then repeat that process for each custom category you require, additionally if you really wanted to bother, you could write a script to programmatically make the alias's for you (with required changes of course) and maybe set it up to run on XY exit via CEA, so that they keep in sync with XY's internal lists if they ever change, but that happens so rarely that I would consider it unnecessary.

edit: If you don't like/want to use the manual route described above, I knocked up a quick script to facilitate the creation of custom categories, after the script is finished just modify existing/create new your desired CFA entry(ies) manually.

Code: Select all

  $kind = inputselect(, "Text|Image|Photo|Audio|Video|Media|Font|Vector|Web|Office|Archive|Executable", , 8224, , "15%", "40%");
  $exts = inputselect(, replace(get("GenericFileType", "{:$kind}", ";"), "*.", "+"), ";", 18, , "25%", "60%");
  $kind = input("Optionally modify category name?",, $kind);
  goto "@$kind=$exts";
  echo """Caption (if desired)"" <get alias $kind>>whatever.exe", "Your CFA entry should look something like this (text is copyable):";
  #614;
@Don: Small suggestion, do you think get('genericfiletype') without params could return the category titles?

Garonne
Posts: 195
Joined: 21 Apr 2015 19:10
Location: Win11, 100% Scaling
Contact:

Re: CFA: Make Generic File Types configurable

Post by Garonne »

Thanks for the ideas to solve my issue.

As long as Don doesn't come up with a solution, I'll most likely go

Code: Select all

text get("genericfiletype", "{:Text}", ";");
or do the Alias trick.

Code: Select all

@Text=accurip;adml;admx;ahk;asc;asp;aspx;au3;b64;bas;bat;c;htaccess;cer;cfg;cmd;cls;conf;config;cnt;ctl;cpp;crt;cs;css;csv;cws;cue;dat;eml;filters;frm;h;hpp;htc;ics;idl;inc;inf;ini;java;js;json;less;lng;log;lrc;lst;lua;m3u;m3u8;manifest;man;map;markdown;md;mht;mhtm;mhtml;mim;mk;msg;nfo;nsi;nws;odl;opml;php;pl;prj;py;pyw;rc;rdf;reg;resx;rst;scss;sh;sln;sql;srt;tbl;txt;uue;url;utf8;vb;vbp;vbs;vbw;vcf;website;wer;wpl;ws;xml;xsd;xsl;xslt;xxe

"Text Category App" <get alias Text>>c:\whatever.exe

admin
Site Admin
Posts: 66097
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: CFA: Make Generic File Types configurable

Post by admin »

I see this almost as a bug, at least as an inconsistency. In the next beta unticking types in Configuration | Preview | Previewed Formats will also remove them from the {:[filetype]}. Note that this has already been done in Visual Filters and Live Filters for years.

Post Reply