Help file - small improvements...

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: 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%).

:info: 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.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

Help file - small improvements...

Post by Borut »

inputfolder()

First example - explanation should read (I suppose):
"Asks the user to select a folder (starting the dialog in C:\) and puts its full name in variable $folder. Then copies the folder name to clipboard."

The intention is clear. This is just an improvement possibility. BTW, congratulations once more for 10.70!
Win 10 Pro 64bit

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

Re: Help file - small improvements...

Post by admin »

Correct, thanks!

Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

Re: Help file - small improvements...

Post by Borut »

Scripting Commands Reference | load | Examples

Either all "goto.xys" should be replaced with "goto.txt" (preferably), or all "Goto.txt" should be replaced with "goto.xys".

Scripting Commands Reference | If/ElseIf/Else Blocks

If expression evaluates to TRUE, the following statement block is executed and the other blocks are ignored.
Win 10 Pro 64bit

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

Re: Help file - small improvements...

Post by admin »

Thanks!

Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

Re: Help file - small improvements...

Post by Borut »

Scripting | Variables | Interpolation

I am really not sure about this one - it may very well be that everything is ok and I am misunderstanding the issue... Help says:
Interpolation means that variables that are embedded in double-quoted or unquoted strings are resolved (replaced with their corresponding value).[...]Interpolating XYplorer internal variables...To avoid ambiguities in parsing, you have to put XY internal variables (<curpath>, <xyver>...) within doubled quotes strings IF they are to be interpolated! Otherwise the < or > character might be interpreted as being the operator within a comparison.
msg XY path = <xypath>; // will not work as expected!
msg "XY path = <xypath>"; // okay
msg "XY path = " . "<xypath>"; // okay (not interpolated)
If I try each of these three lines in the address bar (of course preceded with ::), it seems that <xypath> is being evaluated each time. If I try

Code: Select all

::msg 'XY path = <xypath>';
then it is not evaluated (as expected, I would say).
Win 10 Pro 64bit

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

Re: Help file - small improvements...

Post by admin »

Borut wrote:Scripting | Variables | Interpolation

I am really not sure about this one - it may very well be that everything is ok and I am misunderstanding the issue... Help says:
Interpolation means that variables that are embedded in double-quoted or unquoted strings are resolved (replaced with their corresponding value).[...]Interpolating XYplorer internal variables...To avoid ambiguities in parsing, you have to put XY internal variables (<curpath>, <xyver>...) within doubled quotes strings IF they are to be interpolated! Otherwise the < or > character might be interpreted as being the operator within a comparison.
msg XY path = <xypath>; // will not work as expected!
msg "XY path = <xypath>"; // okay
msg "XY path = " . "<xypath>"; // okay (not interpolated)
If I try each of these three lines in the address bar (of course preceded with ::), it seems that <xypath> is being evaluated each time. If I try

Code: Select all

::msg 'XY path = <xypath>';
then it is not evaluated (as expected, I would say).
You are right. Part of it is outdated, part of it is nonsense, part of it is ok. Thanks!

Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

Re: Help file - small improvements...

Post by Borut »

Scripting | Variables

Here I am again not sure if I am misunderstanding something, or my SC experiments bring me to wrong conclusions, or there is perhaps really a need for some additional clarification... Help says:
Variables that are not set to any value are not resolved, but displayed
My question: Is it so also for permanent (and global) variables? After experimenting a bit, I would say that a permanent variable (after the perm command) has something like a value nil afterwards, i.e. when compared with a string, it seems it has a value "" (empty string). Are my observations correct? If so, maybe this should be written somewhere explicitly (or I was not able to find it).
Win 10 Pro 64bit

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

Re: Help file - small improvements...

Post by admin »

You have example code?

Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

Re: Help file - small improvements...

Post by Borut »

admin wrote:You have example code?

Code: Select all

"Case 1"
  releaseglobals;
  perm $p_TabsetBase;
  $p_TabsetBase=($p_TabsetBase=='$p_TabsetBase') ? '<xydata>\Panes' : "NO CHANGE";
  msg "$p_TabsetBase";

"Case 2"
  releaseglobals;
  perm $p_TabsetBase;
  $p_TabsetBase=($p_TabsetBase=="") ? '<xydata>\Panes' : "NO CHANGE";
  msg "$p_TabsetBase";
Win 10 Pro 64bit

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

Re: Help file - small improvements...

Post by admin »

Hm, don't know what you mean. Here's unsetting a perm var and I don't see any problems:

Code: Select all

"unsetting a perm var"
  perm $p_TabsetBase;
  $p_TabsetBase = "test";
  msg $p_TabsetBase;
  unset $p_TabsetBase;
  msg $p_TabsetBase;

Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

Re: Help file - small improvements...

Post by Borut »

Yes, yes, in your example everything seems OK. BUT, try this:

Code: Select all

"perm var initial state"
    perm $p_TabsetBase;
    msg $p_TabsetBase;
Namely, I need to detect if a value of a permanent global variable has ever been defined or not. I was expecting to receive $p_TabsetBase in the message of this example, but I am apparently receiving an empty string.
Win 10 Pro 64bit

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

Re: Help file - small improvements...

Post by admin »

Borut wrote:Yes, yes, in your example everything seems OK. BUT, try this:

Code: Select all

"perm var initial state"
    perm $p_TabsetBase;
    msg $p_TabsetBase;
Namely, I need to detect if a value of a permanent global variable has ever been defined or not. I was expecting to receive $p_TabsetBase in the message of this example, but I am apparently receiving an empty string.
Ah. The perm command initializes the variable to "". I will add it to Help.

Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

Re: Help file - small improvements...

Post by Borut »

admin wrote:Ah. The perm command initializes the variable to "". I will add it to Help.
But, upon further thinking, although for my purposes I can check after "", it seems that it is actually an inconsistency of the scripting engine. Maybe it would be better to change this behavior (if possible).
Win 10 Pro 64bit

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

Re: Help file - small improvements...

Post by PeterH »

Variables that are not set to any value are not resolved, but displayed
Doesn't this mean, in other words, that it's an undefined variable?

While a non-filled variable defined as global is not undefined?

As much as I remember from other scripting languages they do the same as XY.
And I think I remember that XY documents this way to handle it somewhere...

By the way: after

Code: Select all

   perm $p_TabsetBase;
   $p_TabsetBase = '$p_TabsetBase'
Do you think this var is "not defined" or "not initialized" - what ever this means?

Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

Re: Help file - small improvements...

Post by Borut »

PeterH, if you are directing these questions to me, then I would say: It is all a question of definition.

I do not use other scripting languages, so I do not know how they are handling perm variables. I was not able to find the relevant description in the on-line help (if there already is one about "", then it should perhaps be made more visible (what Don is going to do)), and I have learned the hard way that the one about regular variables does not apply to perm variables. However, I do not see the reason for different treatment. Regarding your code snippet:

Code: Select all

   perm $p_TabsetBase;
   $p_TabsetBase = '$p_TabsetBase'
- it is exactly what I would expect that the scripting engine does, when interpreting a perm command for a variable which is not already in the internal list of permed variables (currently it obviously does this for the regular variables, upon the first occurrence (implicit declaration)).

But, as I said, my scripts now work happily with "" as initial values of perm variables, so my suggestion about changing the scripting engine was just that - a suggestion.
Win 10 Pro 64bit

Post Reply