I wish "GOTO .." worked like the Help says...

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".
Post Reply
Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

I wish "GOTO .." worked like the Help says...

Post by Papoulka »

I was working on a script to move selected files into a parent folder, and ran into many problems. I eventually found this thread:

http://www.xyplorer.com/xyfc/viewtopic. ... ent#p49071

and got things working.

But before that I was stumped for a long time by the fact that Goto ".." seemed to be broken. Even with focus on the list I was working in, it would go off to the parent of my XY home folder! That was completely unexpected and, more confusing,contrary to what the Help says:
goto location, [reuseexistingtab]
location: [Required] A path, a file, a Quick Search, a Visual Filter, or a URL ... whatever is accepted in the Address Bar,
If I type ".." in the Address Bar, it goes to the immediate parent folder - as I would expect and was trying to do in my script. But used in a script, it just runs home to mama.

I thought this must have been debated to death already, because on the surface it is so strange, but didn't find anything.

So I suggest, have Goto ".." work the same in a script as in the Address Bar.

Thanks

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

Re: I wish "GOTO .." worked like the Help says...

Post by PeterH »

Hm.

Try to type goto '..'; into the address bar :roll:

(OK: not what you wanted to read 8) )

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

Re: I wish "GOTO .." worked like the Help says...

Post by TheQwerty »

I don't recall where and cannot currently check but somewhere there is an option to make paths relative to the current path instead of the app path.

nerdweed
Posts: 653
Joined: 25 Feb 2012 07:47
Location: XY64 Latest Beta , Win 11, 96dpi, 100%

Re: I wish "GOTO .." worked like the Help says...

Post by nerdweed »

Its here

Configuration -> Controls & More -> Miscellaneous -> Address bar relative to application path

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: I wish "GOTO .." worked like the Help says...

Post by Papoulka »

.
Thanks, but that checkbox in Controls & More is already un-checked. And it isn't the issue, anyway. I want the Address Bar to keep working as it does: absolute path.

The problem is with the scripting Goto command. It doesn't use the absolute path, even as a switch or option [ideas...].

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: I wish "GOTO .." worked like the Help says...

Post by bdeshi »

moved to bug reports... admins feel free to move to a better place
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: I wish "GOTO .." worked like the Help says...

Post by bdeshi »

goto ".." isn't relative to <curpath> even from the AB.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: I wish "GOTO .." worked like the Help says...

Post by Papoulka »

.
Well, if I type ".." into the Address Bar, it goes to the parent folder. I think (and the Help says) that means the script statement:

Goto "..";

will go to the parent folder. Just like:

Moveto "..";

will move stuff to the parent folder.

Regardless of the Help file, it just makes sense (to me). And besides it would be very useful since AFAIK there is no easy way to simply go to a parent folder! That's all I wanted to do, and this is certainly the most natural command to use for that.

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

Re: I wish "GOTO .." worked like the Help says...

Post by admin »

SC goto is relative to <xypath> (path of XYplorer.exe).

This info is indeed missing from the Help, so thanks for the hint.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: I wish "GOTO .." worked like the Help says...

Post by bdeshi »

wouldn't it be better to make goto relative to <curpath>?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: I wish "GOTO .." worked like the Help says...

Post by PeterH »

SammaySarkar wrote:wouldn't it be better to make goto relative to <curpath>?
I don't remember, why it was made as it is. Perhaps Don does?

But I also think there would be advantages to change it. I think it's as in old DOS days: you accessed a program directory by specifying it explicitely, or via the path= definitions. And the current path was preferibly used to access the data. For me this makes sense.

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

Re: I wish "GOTO .." worked like the Help says...

Post by admin »

1) Just as an aside: There is a setting for this for the Address Bar:
Configuration | Controls and More | Miscellaneous | Address Bar relative to application path
But I would not make scripts behavior dependent on a user setting.

2) Not sure. And it might break scripts. Hmm...

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

Re: I wish "GOTO .." worked like the Help says...

Post by TheQwerty »

There are so many solutions to this that I don't think XY should change at all...

Code: Select all

goto "<xypath>\..";
goto "<curpath>\..";
There's the go up command ID, or you could use GetPathComponent to get the parent and go there.

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: I wish "GOTO .." worked like the Help says...

Post by Papoulka »

Thanks, TheQwerty

I was doing it a much harder way; saving a variable with some regex path extraction statement. Saw that in the only script I ran across that relocated to a parent folder. If I had known it was as simple as:

Code: Select all

goto "<curpath>\..";
I wouldn't have posted the wish.

I agree that XY shouldn't be changed as it would break earlier scripts. And given the above function there is no need to add anything new. It might be worth adding this to the Help, however, as the workaround for goto ".." not inherently using <curpath>.

Post Reply