Scripting Bugs

Things you’d like to miss in the future...
Post Reply
TheQwerty
Posts: 4353
Joined: 03 Aug 2007 22:30

Scripting Bugs

Post by TheQwerty »

Just starting a thread for scripting related bugs.

::set no longer seems to work with v6.80.0052.

I know the change log shows a bunch of updated functionality but it doesn't seem to be doing anything.

Code: Select all

::Set $a, asdf::copyText $a
That should put "asdf" on my clipboard right?
When I paste I end up with "$a".

EDIT: Also, is there an XY variable that has path to XY? (Equivalent of "." in a goto)

EDIT 2: Actually, it looks like it will only do the set if the value contains the separator.

::set well, well, well, well::copyText well
Works.
::set well, swell::copyText well
Doesn't work.

admin
Site Admin
Posts: 50916
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Scripting Bugs

Post by admin »

Fix coming...
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

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

Post by TheQwerty »

All better Don! Thank you!

So is there an XY variable (like <xypath> or something?) equivalent to XY's working directory?

/me Is excited to try out the new Caption IDs.

admin
Site Admin
Posts: 50916
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Post by admin »

TheQwerty wrote:So is there an XY variable (like <xypath> or something?) equivalent to XY's working directory?
Oh, forgot that. Next version will have <xypath>: returns XY's path without last slash.
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

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

Post by TheQwerty »

admin wrote:
TheQwerty wrote:So is there an XY variable (like <xypath> or something?) equivalent to XY's working directory?
Oh, forgot that. Next version will have <xypath>: returns XY's path without last slash.
Fantastic! Thanks again, Don!

admin
Site Admin
Posts: 50916
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Post by admin »

TheQwerty wrote:
admin wrote:
TheQwerty wrote:So is there an XY variable (like <xypath> or something?) equivalent to XY's working directory?
Oh, forgot that. Next version will have <xypath>: returns XY's path without last slash.
Fantastic! Thanks again, Don!
I have a question. Here are 3 variables, 2 of them new:

Code: Select all

      <curpath> The real current path
                e.g. C:\Dokumente und Einstellungen\Donald\Desktop
                     C:\Dokumente und Einstellungen\Donald\Desktop\New Stuff
                     C:\
      <curpath_s>  The special current path (if applicable, else = <curpath>)
                e.g. Desktop
                     Desktop\New Stuff
                     C:\
      <xypath>  XYplorer's path
                e.g. C:\Programs\XYplorer
I coded <curpath> to return the path without last backslash (unless it's a drive). While I normally comment my code as a madman, in this case I did not. Now I ask myself: WHY without backslash??? I would find it more convenient and more predictable (because drives and paths would behave identical) if the path would be returned with backslash always! Any idea why I did that? Otherwise I will change that code for all 3...
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

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

Post by TheQwerty »

admin wrote:I coded <curpath> to return the path without last backslash (unless it's a drive). While I normally comment my code as a madman, in this case I did not. Now I ask myself: WHY without backslash??? I would find it more convenient and more predictable (because drives and paths would behave identical) if the path would be returned with backslash always! Any idea why I did that? Otherwise I will change that code for all 3...
Looking back through the forums it doesn't look like it was ever mentioned. And I can't think of any reason you might have done it that way.

I'd agree it would be more convenient and predictable to have the backslash.

However, now that it's been implemented for a while, that might screw things up for existing users. I suppose you could code around that, or just make a note of it at release time so users can fix it. If you don't change it though I'd say keep things consistent and not add the backslash to new variables.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

admin wrote:I coded <curpath> to return the path without last backslash (unless it's a drive). While I normally comment my code as a madman, in this case I did not. Now I ask myself: WHY without backslash??? I would find it more convenient and more predictable (because drives and paths would behave identical) if the path would be returned with backslash always! Any idea why I did that? Otherwise I will change that code for all 3...
Well, I might disagree a little here.

I'm not sure why you did it, but it could be for some consistency with other variables like that, like environment variables which do NOT have a blackslash, cause it's easier to work with them that way : %tmp%\file.ext is better than %tmp%file.ext which is more obviously confusing

For that reason I would say that not having the backslash is better, but of course there's the drive issue. I would tend to think that those variables would be mostly use as such, or with something added after, so keeping them backslash-free would be better I would say : "<curpath>\New Folder"

Maybe XY could get smart and check for a case of "D:\" and "fix" it on the fly for us ? Or would that somehow be a bad idea ?
Proud XYplorer Fanatic

PeterH
Posts: 2599
Joined: 21 Nov 2005 20:39
Location: Germany

Post by PeterH »

Sorry just to pop-in here, but: if a path should be specified without trailing \ - why should uppermost path (i.e. drive) be specified with trailing \
(And didn't I learn, the drive is c: ?)

So what I want to say: I would make it same for both situations: either all with or all without trailing \

This is my kind of view...

admin
Site Admin
Posts: 50916
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Post by admin »

PeterH wrote:Sorry just to pop-in here, but: if a path should be specified without trailing \ - why should uppermost path (i.e. drive) be specified with trailing \
(And didn't I learn, the drive is c: ?)

So what I want to say: I would make it same for both situations: either all with or all without trailing \

This is my kind of view...
I'd love to, but AFAIK it's a Windows standard that drives are always slashed (where did you learn othewise?). At least some API will not recognize an unslashed drive.

OTOH, you are right. I can leave that slashing to the user easily and especially when I unslash the drives as well!

@jacky: yep, now I remember! It was indeed consistency with environment vars that made me do it! Also, it's easier for the user to add a slash than to remove one.

So, bottom line of me: unslash ALL, even drives!
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

admin wrote:So, bottom line of me: unslash ALL, even drives!
Yep, sounds good. We can just use "<curpath>" in scripts anyway, whether or not adding anything to it.
Proud XYplorer Fanatic

PeterH
Posts: 2599
Joined: 21 Nov 2005 20:39
Location: Germany

Post by PeterH »

it's a Windows standard that drives are always slashed (where did you learn othewise?)
I didn't think about that. But I have a look!

In CMD-Window I type c: to change to c: :roll:
If I go to Arbeitsplatz in XY or in Explorer I see WXP [C:]
Using SET in CMD I see HOMEDRIVE=C:
Isn't that enough? Especially the last case - I should have seen this first :roll: - isn't that exactly what you are looking for?

admin
Site Admin
Posts: 50916
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Post by admin »

PeterH wrote:
it's a Windows standard that drives are always slashed (where did you learn othewise?)
I didn't think about that. But I have a look!

In CMD-Window I type c: to change to c: :roll:
If I go to Arbeitsplatz in XY or in Explorer I see WXP [C:]
Using SET in CMD I see HOMEDRIVE=C:
Isn't that enough? Especially the last case - I should have seen this first :roll: - isn't that exactly what you are looking for?
It's jacky's fault! :P He told me! :lol:
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

PeterH
Posts: 2599
Joined: 21 Nov 2005 20:39
Location: Germany

Post by PeterH »

Hey - it's so easy?
I told you about security and subdirectories... :?

admin
Site Admin
Posts: 50916
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Post by admin »

PeterH wrote:Hey - it's so easy?
I told you about security and subdirectories... :?
Just kidding, Open Explorer and do some browsing. You'll see: drives are always slashed, folders not.
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

Post Reply