quotes in function-variables (<get >, <prop >)
Forum rules
You might want to read this if you're looking for priority service
Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
You might want to read this if you're looking for priority service
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
-
PeterH
- Posts: 2830
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: Scripting Bugs
For me it shows that there's something wrong in the concept. (Beside the situation, that stacking quotes often looks quite strange...)admin wrote:I share TheQwerty's mixed feelings about this. All these work now, and some of them do look a bit funny:
Code: Select all
echo <get "genericfiletype" '{:Image}'>; echo "<get "genericfiletype" '{:Image}'>"; //hmm... echo "<get ""genericfiletype"" '{:Image}'>"; //hmm... echo eval("<get " . "genericfiletype" '{:Image}'>); $g = genericfiletype; echo eval(<get "$g" '{:Image}'>);
But in general: what's a constant, and what's a variable? For example:
$g = genericfiletype; echo eval(<get "$g" '{:Image}'>);
OK: the left side must be quoted if I'm right: $g = 'genericfiletype';
So $g is a variable containing a string. Then in
echo eval(<get "$g" '{:Image}'>);
$g is a variable
For me:
echo <get "genericfiletype" '{:Image}'>;
is straight forward as expected. (The complete <get ...> is a special *variable* and can be used unquoted.
echo "<get "genericfiletype" '{:Image}'>"; //hmm...
For me this looks like a syntax error :-(
echo "<get ""genericfiletype"" '{:Image}'>"; //hmm...
Formally it looks clean
echo eval("<get " . "genericfiletype" '{:Image}'>);
Then for "abc=$abc" you should be able to write "abc=$a"."bc"
Back to the roots: what are these "operands" in a <get ...>?
- they might be strings ==> must be quoted
- they might be codewords ==> unquoted, but no operand may contain spaces.
And the latter is unusual for XY: operands usually don't use codewords ( Status "msg", "ff0000", "alert"; ) Here alert is a string (representing a codeword), not a direct codeword. Advantage af a string: can be replaced by a variable - a codeword can't.
So I'm afraid: some thinking is required - or syntax can't become clean.
The root of problems seems to be a "variable" <get ...> containing strings.
(By the way: there *are* codewords, that are no strings: get, or substr for example.)
Sorry for long post, wasn't able to get it shorter
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Scripting Bugs
These were just some partly extreme examples of what works. I did not mean them to be suggestions.
The recent changes were done to achieve more consistency between get(...) and <get ...>.
But there is at least one fundamental syntactic difference:
In get(...) arguments are separared by commas, therefore arguments containing a comma MUST be quoted.
In <get ...> arguments are separared by spaces, therefore arguments containing a space MUST be quoted.
The recent changes were done to achieve more consistency between get(...) and <get ...>.
But there is at least one fundamental syntactic difference:
In get(...) arguments are separared by commas, therefore arguments containing a comma MUST be quoted.
In <get ...> arguments are separared by spaces, therefore arguments containing a space MUST be quoted.
FAQ | XY News RSS | XY X
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Scripting Bugs
Seeing the blatant and horrific disregard for sanity syntax that the newly risen <get > displays, I'm tempted to say the old way was better; not "better" better, "less worse" better.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Scripting Bugs
can't deny that. So there's a compromise: either strict quotes or quotes galore!
"The new way" is not really unbearable and more than what I wanted, but only creates a different kind of headache.
how do you make this work anyway?is it interpreted like this?
"The new way" is not really unbearable and more than what I wanted, but only creates a different kind of headache.
how do you make this work anyway?
Code: Select all
echo "<get "genericfiletype" '{:Image}'>"; //hmm...Code: Select all
echo "<get ". genericfiletype . " '{:Image}'>";Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Scripting Bugs
Can we just stop using the variable version of Get in places where it makes no sense?
It only exists to provide access to the capabilities of the Get command in places where scripting is not available - the title bar template being the main one.
If you are writing a script there is absolutely no reason to ever use <get ...> or <prop ...>.
It only exists to provide access to the capabilities of the Get command in places where scripting is not available - the title bar template being the main one.
If you are writing a script there is absolutely no reason to ever use <get ...> or <prop ...>.
-
PeterH
- Posts: 2830
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: Scripting Bugs
Makes sense? Lazyness?TheQwerty wrote:Can we just stop using the variable version of Get in places where it makes no sense?
It only exists to provide access to the capabilities of the Get command in places where scripting is not available - the title bar template being the main one.
If you are writing a script there is absolutely no reason to ever use <get ...> or <prop ...>.
You can use <get ...> inside a double-quoted string.
With get() you have to break the string into parts, and use concatenation.
I think in the end you are right: the format of <get ...> being a variable, but containing "internal strings", isn't really good for scripts. The syntax doesn't really fit.
But it's there. So sometimes you are tempted...
XYplorer Beta Club