Questions about /path=

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
reyaz
Posts: 18
Joined: 29 Feb 2016 17:15

Questions about /path=

Post by reyaz » 13 Mar 2016 11:09

1. XYplorer seem to not always selecting correct files when /path= command is used. See:
  1. When XYplorer is executed with

    Code: Select all

    XYplorer.exe /path="C:\Docs\file16.pdf"
    It should open a tab with C:\Docs\ and select file16.pdf.
  2. If XYplorer's last location was C:\Docs\ and last selected file was doc2015.txt, the same command line will just open the last view, it won't select file16.pdf.
  3. If XYplorer's last location was not C:\Docs\, the same command line will work as expected.
  4. If XYplorer is opened, it will re-open this location and properly select file16.pdf.
Is this a bug or is there an option to make it behave as I expect, to fix (b) point?

2. I see there is an option "Open command line start path in new tab", but is it possible to make it re-use one tab if the path in question was already opened in some non-active tab? Because with this option enabled, it does so if it was opened in active tab.

highend
Posts: 8476
Joined: 06 Feb 2011 00:33

Re: Questions about /path=

Post by highend » 13 Mar 2016 12:34

You shouldn't use /path to go to a specific file.

Just use the file name as an argument.

Like:

Code: Select all

XYplorer.exe "C:\Docs\file16.pdf"
2. You could always use a script instead to do that
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

reyaz
Posts: 18
Joined: 29 Feb 2016 17:15

Re: Questions about /path=

Post by reyaz » 13 Mar 2016 14:08

Thanks for reply.

I've just tried it, and there is no difference between

Code: Select all

XYplorer.exe /path="C:\Docs\file16.pdf"
and

Code: Select all

XYplorer.exe "C:\Docs\file16.pdf"
And it still does not select the proper file, if last view was the same folder but last selected file was a different file.

In fact, it appears to try doing that - I can see the "file16.pdf" file appears selected if I scroll to its position after XYplorer launches. But if I try to press up/down arrow keys, the selection goes up/down from the last selected file, not from the "file16.pdf". It's like XYplorer only highlights it in this case.

In the end, it only properly selects it when XYplorer is already opened. In other cases, selection is not set properly. I'm beginning to think this is a bug.

About the script, how should it look like and how do I set it up to work from command line?

I now also have another question. If I have another folder in C:\Docs\, e.g. C:\Docs\downloaded_2015\, it seems impossible to start XYplorer with C:\Docs\ opened and "downloaded_2015" selected. Instead it just opens C:\Docs\downloaded_2015\ folder. While in Explorer it's possible with /select command line. Is this intended or there is an option to change it?

SammaySarkar
Posts: 4221
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Questions about /path=

Post by SammaySarkar » 14 Mar 2016 18:57

reyaz wrote: About the script, how should it look like and how do I set it up to work from command line?

Code: Select all

"Path\to\xyplorer.exe" /script="::goto 'Target\Path';selectitems 'target.item'; sel '+0';focus;"
You should type any single quotes in target path or item twice.
The sel +0;focus; bit at the end ensure the target item is selected and visible in list "viewport". :ugeek:
reyaz wrote:If I have another folder [...] C:\Docs\downloaded_2015\, it seems impossible to start XYplorer with C:\Docs\ opened and "downloaded_2015" selected. Instead it just opens C:\Docs\downloaded_2015\ folder.
Using the script command shown above,

Code: Select all

"Path\to\xyplorer.exe" /script="::goto 'C:\Docs';selectitems 'downloaded_2015'; sel '+0';focus;"
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

reyaz
Posts: 18
Joined: 29 Feb 2016 17:15

Re: Questions about /path=

Post by reyaz » 16 Mar 2016 13:02

Thanks for reply.

I see from your script that I'd need to split the target path in order to launch XYplorer with this script. But this might not be possible. What I'm trying to achieve is a proper integration with "Everything" application, which happens to allow setting few custom shell commands for all files and folders. Launching certain app with a certain command line and adding "%1" is really all it can do. And I expect it to be same for any other application with similar capabilities.

Therefore, I think it would be best to request such a feature to be implemented in XYplorer, for example as a separate command line.

sinilill
Posts: 111
Joined: 02 Dec 2013 18:37

Re: Questions about /path=

Post by sinilill » 19 Mar 2016 11:30

In Everything use

Code: Select all

$exec("path\to\XYplorer.exe" "%1")

reyaz
Posts: 18
Joined: 29 Feb 2016 17:15

Re: Questions about /path=

Post by reyaz » 29 Mar 2016 12:40

As I've said already, I've tried it and it's 100% same as with /path= command line. It has all the same problems:
- highlighting a file instead of selecting it; (which is a huge difference - as a result, often needed to execute the command twice before it selects the proper file)
- opening a target folder instead of selecting it in its parent folder.

I conclude that /path=%1 (and simple %1) is just not really useful for files. It only works perfectly for folders, thus "path" command name is justified.

The feature I'm asking about is not implemented yet. I've posted a thread at Wishes subforum about it: http://www.xyplorer.com/xyfc/viewtopic.php?f=5&t=15588

sinilill
Posts: 111
Joined: 02 Dec 2013 18:37

Re: Questions about /path=

Post by sinilill » 29 Mar 2016 15:14

AFAIK Xyplorer doesn't have a "/path" command line switch, so don't use it :D

In my case:
$exec("path\to\XYplorer.exe" "%1") always selects the file or opens the folder path.

if you want to open in parent folder and select the folder path, then you could use:
$exec("path\to\XYplorer.exe" /script="::goto'%1';#523;")

or you could write your own script which detects if it's a file or a folder path and behaves exactly as you like it.

highend
Posts: 8476
Joined: 06 Feb 2011 00:33

Re: Questions about /path=

Post by highend » 29 Mar 2016 15:19

AFAIK Xyplorer doesn't have a "/path" command line switch, so don't use it :D
Ehem^^
/path

Lets you control the startup path, optionally quoted (quotes are needed if the path contains spaces).

XYplorer.exe /path=C:\

XYplorer.exe /path="C:\New Folder"

Note that you can also pass the startup path as an unamed switch, see below. However, the /path switch will overwrite any unnamed switch.
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

sinilill
Posts: 111
Joined: 02 Dec 2013 18:37

Re: Questions about /path=

Post by sinilill » 29 Mar 2016 15:28

:oops: I had a older version of XYplorerHelp.pdf

reyaz
Posts: 18
Joined: 29 Feb 2016 17:15

Re: Questions about /path=

Post by reyaz » 29 Mar 2016 16:38

I think the functionality in question is too basic for the application that replaces Windows Explorer, especially because Windows Explorer itself has a dedicated command line for this.

I've checked scripting section in Help, and I see there are several issues already with no apparent solution:
- I don't see a way to determine whenever a file or a folder being passed through the command line. There can be a file named C:\file.zip and a folder named C:\file.zip, and apparently a script can't know that.
- I don't understand whenever I should crunch the whole script in a single line or pass a script file into command line instead. Then, I don't know whenever an additional parameter is supported in that case, for %1 to pass properly.

highend
Posts: 8476
Joined: 06 Feb 2011 00:33

Re: Questions about /path=

Post by highend » 29 Mar 2016 17:05

and apparently a script can't know that.
Sure it can. exists() is the necessary script command for that
I don't understand whenever I should crunch the whole script in a single line or pass a script file into command line instead. Then, I don't know whenever an additional parameter is supported in that case, for %1 to pass properly.
That depends on how much scripting is necessary..

Personally I don't understand the problem^^

If I use:
Open (Files):
$exec("D:\Users\Highend\Tools\XYplorer\XYplorer.exe" /script="::goto'%1';")

Open (Folders):
$exec("D:\Users\Highend\Tools\XYplorer\XYplorer.exe" /script="::goto'%1';#523;")

Files / Folders are displayed and selected correctly in XY. If something's still not quite right you can look at Sammay's post and enhance this "mini script" with the necessary commands?
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

reyaz
Posts: 18
Joined: 29 Feb 2016 17:15

Re: Questions about /path=

Post by reyaz » 29 Mar 2016 19:10

The problem is, for any script function you have to use "(" and ")". But Everything application is not so smart - it sends the command line between first "(" and first ")". So, anything after the first ")" is going to get ignored. Simple example, I set this as execute command:

Code: Select all

$exec("%PROGRAMFILES(X86)%\XYplorer\XYplorer.exe" /script="::echo exists('%1')")
This is what you'd expect as a result command line:

Code: Select all

"C:\Program Files (x86)\XYplorer\XYplorer.exe" /script="::echo exists('C:\test.txt')"
This is what gets executed instead:

Code: Select all

"C:\Program Files (x86)\XYplorer\XYplorer.exe" /script="::echo exists('C:\test.txt'
Like I've said previously, most applications are only good for sending simple command lines with %1 variable.

highend
Posts: 8476
Joined: 06 Feb 2011 00:33

Re: Questions about /path=

Post by highend » 29 Mar 2016 19:19

I still don't understand why you're not using

Open (Folders)
Open (Files)

for XY to be called. You don't need to use exists() in these cases...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

reyaz
Posts: 18
Joined: 29 Feb 2016 17:15

Re: Questions about /path=

Post by reyaz » 29 Mar 2016 19:52

I'm still using default setting for those. Also I don't see why would I want to change "Open (Files)" operation. If I just want to open some file, I don't need XYplorer to show it to me first.

I already have "Open Path" set to [explorer.exe /select], and "Explore Path" set to [XYplorer /path]. I'd like them both to work as single commands for both files and folders.

Post Reply