Should <curitem> return the current path?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Should <curitem> return the current path?

Post by admin »

Should <curitem> return the current path in case no item in list is selected/focused? Right now it returns an empty string in that case.

I'd say yes!

graham
Posts: 457
Joined: 24 Aug 2007 22:08
Location: Isle of Man

Post by graham »

I am not sure on this, as returning an emty string does prevent, say, a script using this and deleting or altering file content unexpectidly. That said, it is not something I have used much so not the best qualified on its application.

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

Re: Should <curitem> return the current path?

Post by jacky »

Yeah I agree that it may sound "weird", and as I was questioning myself I thought that since Ctrl+P right now works that way (current path if no item selected), maybe it should, too.

But I'm not so sure and would say "no" in fact, because <curitem> refers to the currently focused&selected List item, where as Ctrl+P refers to "the full path/name of all selected Tree or List items", so it is pretty different and makes more sense then, since if nothing on List is available it goes back to Tree.

<curitem> does seem to be in a quite different situation, as it only refers to list, so never returns a (/the current) path. No "current item", then nothing returned (empty string). Makes more sense to me like that, plus goes along with other variales such as <curext>, <curbase>, etc
Proud XYplorer Fanatic

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

Re: Should <curitem> return the current path?

Post by admin »

Okay, I expected resistance from the purists. :)

So I'll add another variable <cur> which will return either the current list item or, if none, the current path.
You know why I want it? I need it for my convert <cur> to URL script. I want to use the same script and keyboard shortcut for tree and list.

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: Should <curitem> return the current path?

Post by yusef88 »

admin wrote:Okay, I expected resistance from the purists. :)

So I'll add another variable <cur> which will return either the current list item or, if none, the current path.
You know why I want it? I need it for my convert <cur> to URL script. I want to use the same script and keyboard shortcut for tree and list.
sorry for the inconvenience..where is it?
cant find it in the xyplorer help, variables section.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Should <curitem> return the current path?

Post by Stefan »

In the past 5 1/2 years there has many things changed (if it was implemented at all?).


If you need such a var, maybe you can utilize such a code?

Code: Select all

::if("<curitem>"==""){$cur="<curpath>";}else{$cur="<curitem>";} msg $cur;

or formated another way

Code: Select all

  if( "<curitem>" == "" ){
       $cur = "<curpath>";
  }else{
       $cur = "<curitem>";
  } 
  msg $cur;


(see XYplorer Help > "Advanced Topics > Variables" for more XYplorer Native Variables)


.

Post Reply