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

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: 9101
Joined: 06 Feb 2011 00:33

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 paypal_donate (at) stdmail (dot) de

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

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: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

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".
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

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

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= 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= AFAIK Xyplorer doesn't have a "/path" command line switch, so don't use it 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:

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 paypal_donate (at) stdmail (dot) de reyaz Posts: 18 Joined: 29 Feb 2016 17:15 ### Re: Questions about /path= 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: 9101
Joined: 06 Feb 2011 00:33

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 paypal_donate (at) stdmail (dot) de

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