Option to auto-replace illegal chars on input dialogs

Features wanted...
Post Reply
1024mb
Posts: 230
Joined: 14 Dec 2018 23:26
Location: Windows 10 @ 100%

Option to auto-replace illegal chars on input dialogs

Post by 1024mb »

There have been times where I've pasted some text that has illegal characters and I don't notice them or simply forget about them but upon clicking OK the script fails because I use that input as a filename and Windows doesn't accept certain chars.

Could you add an option so XYplorer auto replaces on paste the illegal characters or just don't accept them showing an error?

Delphine
Posts: 58
Joined: 24 Jun 2019 18:37

Re: Option to auto-replace illegal chars on input dialogs

Post by Delphine »

What's an "illegal" character ?
W11, 28.20, 100%

Horst
Posts: 1387
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Option to auto-replace illegal chars on input dialogs

Post by Horst »

And how should XY know what purpose your input has in advance ?
If you make such errors often you can add a routine to your scripts to make a check according to some rules.
Windows 11 Home, Version 25H2 (OS Build 26200.8655)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1416b (x64), Everything Toolbar 2.4.1, Listary Pro 7.0.0.1 beta

1024mb
Posts: 230
Joined: 14 Dec 2018 23:26
Location: Windows 10 @ 100%

Re: Option to auto-replace illegal chars on input dialogs

Post by 1024mb »

Delphine wrote: 23 May 2021 18:36 What's an "illegal" character ?
In Windows are: ":", """ (quote), "?", "*", "\", "/", "<", ">" and "|" . Also you can't name "con", "com#" or "nul" any file or folder.
Horst wrote: 23 May 2021 18:41 And how should XY know what purpose your input has in advance ?
If you make such errors often you can add a routine to your scripts to make a check according to some rules.
I was thinking by implementing a name input dialog command or adding a param so we can set a dialog to be like that.

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

Re: Option to auto-replace illegal chars on input dialogs

Post by highend »

You could just do it with a:

Code: Select all

    $input = '"a<>b|*c?d\e/f'; // You'd be using an input() here... 
    $input = regexreplace($input, "(^(con|com#|nul)$|[""?*\\/<>|])", "_");
One of my scripts helped you out? Please donate via Paypal

1024mb
Posts: 230
Joined: 14 Dec 2018 23:26
Location: Windows 10 @ 100%

Re: Option to auto-replace illegal chars on input dialogs

Post by 1024mb »

highend wrote: 23 May 2021 19:48 You could just do it with a:

Code: Select all

    $input = '"a<>b|*c?d\e/f'; // You'd be using an input() here... 
    $input = regexreplace($input, "(^(con|com#|nul)$|[""?*\\/<>|])", "_");
I will try that, thank you!

Post Reply