CopyTextA : I don't get it

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

CopyTextA : I don't get it

Post by jacky »

Don't have much time right now, but i was reading the changelog and there's something I don't understand. But first, me likes that source argument for move/copy/backup commands ! :D

Okay, now about this :

Code: Select all

    * Scripting command changed/added: 
      - CopyText, CopyTextA 
        The 2nd optional argument "a" for append has been dropped. 
        Reason: Allow the text argument to contain commas (argument 
        separators) without problems (see next paragraph). 
  (...)
      - CopyText, CopyTextA, Msg 
        Now the text argument can contain commas+blanks without 
        problems. They will not be confused with argument separators. 
        Example: 
          ::copytext one, two, three 
            Copies "one, two, three" to the clipboard. 
I read that and I went What, why!? No really, not that I was in love the the optional argument "a" (though I liked it) but I don't understand, I could copy "one, two, three" just fine already, all I had to do was to use the command made for that : sep
::sep ;::copytext one, two, three

Now you start doing this, why not do it for new or moveto or any other command, I mean what if i want to use coma+blank inside an argument there ? I know that's what ::sep is for, but that's my point! ;)

Isn't this getting things a little confusing, because it's not that when there are no more arguments, then the coma+blank gets seen as part of the last one, it's only a "special feature" for some commands... so now people won't be used to use the sep command and might think it's fine to use coma+blank on their text, yet that won't do what they expect:
::inputfile $file, D:\, rar;zip, Choose an archive, either a RAR or a ZIP file

Just my 2cts...
Proud XYplorer Fanatic

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

Re: CopyTextA : I don't get it

Post by admin »

jacky wrote:I read that and I went What, why!? No really, not that I was in love the the optional argument "a" (though I liked it) but I don't understand, I could copy "one, two, three" just fine already, all I had to do was to use the command made for that : sep
::sep ;::copytext one, two, three
Yes, sure. But I thought a comma is most likely found in a text, less likely in a file name. Okay, middle-likely in a caption. I think it's middle-confusing, but that's what reality is, too. I'm just mirroring it.

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

Post by PeterH »

I'm afraid one reason for this is that Don decided to work with unquoted strings, like in
::msg hello, world
This problem would not arise in
::msg 'hallo, world'
(Don't get me wrong: for ::msg, I think, there isn't such a problem, as it only has one operand. I only use it to describe the situation in principle.)


And the 2 variants
::set world, 'Don'
::msg 'hello, world'
::msg 'hello, 'world
could be a bit surprising.
(Try the first version / the first 2 lines with unquoted strings...)

For the current solution it's often neccessary to know, what a , means. But when the last operand of a command has started, another , cannot be separator - it must be part of the string. And that's what Don is forcing by his modification - it's making life with unquoted strings a bit more easy.

Post Reply