Various Script Wishes

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

Post by admin »

Twisten wrote: :idea: or if calling a script command using variables like so:
command $1, $2 ,$3;
will be treated differently by xyplorer so it wouldn't need the parameters quoted even if for example the variable $2 contained some ,;" chars?
A variable can contain anything without posing a problem. It's only literal strings that have to be quoted when containing separators. That's pretty standard in scripting languages AFAIK.

Please, give an example of a statement that troubles you.

Twisten
Posts: 204
Joined: 27 Apr 2008 10:30

Post by Twisten »

well i'll try and give a simple example (its very late):

if i recall correctly this case gives a problem
RegExReplace $r, $s, "["`'](?=\d+)", " ";

are you saying that this will work fine, where $p=["`'](?=\d+):
RegExReplace $r, $s, $p, " ";


still i wasn't thinking that clearly with that idea since:
set $p, ["`'](?=\d+);
is subject to the same parsing, its seems the only way to make it work is to turn
["`'](?=\d+)
to
"[""`'](?=\d+)"

which feels just plain wrong to read when looking at the pattern and would even be misleeding if the " wasn't in [] .

if you're expecting the commands last parameter and it started with a " and you have a "; at the end is it neccessary to count pairs of "

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

Post by admin »

Twisten wrote:well i'll try and give a simple example (its very late):

if i recall correctly this case gives a problem
RegExReplace $r, $s, "["`'](?=\d+)", " ";

are you saying that this will work fine, where $p=["`'](?=\d+):
RegExReplace $r, $s, $p, " ";


still i wasn't thinking that clearly with that idea since:
set $p, ["`'](?=\d+);
is subject to the same parsing, its seems the only way to make it work is to turn
["`'](?=\d+)
to
"[""`'](?=\d+)"

which feels just plain wrong to read when looking at the pattern and would even be misleeding if the " wasn't in [] .

if you're expecting the commands last parameter and it started with a " and you have a "; at the end is it neccessary to count pairs of "
I see 2 workable ways:

(1) double all " inside "..."

Code: Select all

Set $p, "[""`'](?=\d+)"; 
  RegExReplace $r, $s, $p, " "; 
It might feel wrong but it is pretty standard I think.

(2) 2 steps with a replacement

Code: Select all

Set $p, [@`'](?=\d+); 
  Replace $p, $p, @, """";
  RegExReplace $r, $s, $p, " ";

Twisten
Posts: 204
Joined: 27 Apr 2008 10:30

Post by Twisten »

yeah, i guess you're right, i'll get used to it. probably just feel akward because i've never had to do such things with programming languages and shell scripts.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Various Script Wishes

Post by TheQwerty »

Small and I would think very simple wish for a new variable.
<xyini> or <xyconfig> = Name of XY's current configuration.

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

Re: Various Script Wishes

Post by admin »

TheQwerty wrote:Small and I would think very simple wish for a new variable.
<xyini> or <xyconfig> = Name of XY's current configuration.
Are you thinking of full path/name, filename, or file base?

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Various Script Wishes

Post by TheQwerty »

admin wrote:
TheQwerty wrote:Small and I would think very simple wish for a new variable.
<xyini> or <xyconfig> = Name of XY's current configuration.
Are you thinking of full path/name, filename, or file base?
Well the path should always be the same as <xydata>, right?

I was thinking the filename, but if the config file has to have an extension of INI for XY to use it then just the base would be fine.

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

Re: Various Script Wishes

Post by admin »

TheQwerty wrote:
admin wrote:
TheQwerty wrote:Small and I would think very simple wish for a new variable.
<xyini> or <xyconfig> = Name of XY's current configuration.
Are you thinking of full path/name, filename, or file base?
Well the path should always be the same as <xydata>, right?

I was thinking the filename, but if the config file has to have an extension of INI for XY to use it then just the base would be fine.
Yes, always <xydata> and always INI, but depending on what you have in mind with it, what is returned could make a difference at least in usability. I think filename is okay (base.ext) for most uses (who knows I might allow extensions other than INI one day).

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Various Script Wishes

Post by TheQwerty »

admin wrote:Yes, always <xydata> and always INI, but depending on what you have in mind with it, what is returned could make a difference at least in usability. I think filename is okay (base.ext) for most uses (who knows I might allow extensions other than INI one day).
My initial thought was a more advanced INI-Tweak editor.

I couldn't find jacky's original script that does it, but I believe it required defining all the tweaks in the script. This variable (along with <xydata>) should make it possible to use ReadFile to find the comments to determine all (or at least most) of the tweaks.

It might also be useful to users that work with multiple XY configs for whatever reason.

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Various Script Wishes

Post by PeterH »

admin wrote: Yes, always <xydata> and always INI, but depending on what you have in mind with it, what is returned could make a difference at least in usability. I think filename is okay (base.ext) for most uses (who knows I might allow extensions other than INI one day).
As long as scripts normally would *not* change the extension, I also think base.ext-form should be best.
The better that this would serve for a theoretical change of .ini-suffix...

Post Reply