File links from other programs + XYplorers PFA.

Features wanted...
Post Reply
sinilill
Posts: 111
Joined: 02 Dec 2013 18:37

File links from other programs + XYplorers PFA.

Post by sinilill »

Hi, many programs have support for file links and I can pass those file links to XYplorer. When passing a file link to XYplorer, then it goes to the folder and selects the file.
Can I make XYplorer somehow use it's PFA and open the file directly when a file link is passed to XYplorer? I didn't find any suitable command line switches and XYplorer.exe /script="::open"myfile.ext"" tries to open a folder path.

And it all would happen silently in the background, when XY in minimized, then it should stay minimized!

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

Re: File links from other programs + XYplorers PFA.

Post by highend »

Your open... command is quoted incorrectly.

use /script="::open '<path to your file>\file.ext';" /flg2

This uses PFA...

Invoking XY with a command line comes at a cost: It will automatically restore from minimized mode

Alternatively: Write e.g. an .ahk script that sends the command + file via WM_COPYDATA to XY
and then it will not restore from that state. Ofc you need to invoke that "mediator" from your application instead of XY.
One of my scripts helped you out? Please donate via Paypal

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

Re: File links from other programs + XYplorers PFA.

Post by sinilill »

Sometimes the file links can also be folder paths, how can I use the return values of the exists command to open folders in a new tab, because folder paths also exist, but they are opened in Windows Explorer :D
This AHK script is working, except folder paths are opened in WE

Code: Select all

Process, Exist, XYplorer.exe
If Not ErrorLevel {
	Run, XYplorer.exe
	sleep, 1000
}
Script = :: if (exists("%1%")) {open "%1%";} elseif {tab("new", "%1%");} else {msg "File/Folder %1% Not Found"}
WM_COPYDATA := 74 ; 0x4A
HWND := WinExist("ahk_class ThunderRT6FormDC")
DWData := 4194305
Size := StrLen(Script)
If !(A_IsUnicode) {
   VarSetCapacity(Data, Size * 2, 0)
   StrPut(Script, &Data, "UTF-16")
} Else {
   Data := Script
}
VarSetCapacity(COPYDATA, A_PtrSize * 3, 0)
NumPut(DWData, COPYDATA, 0, "Ptr")
NumPut(Size * 2, COPYDATA, A_PtrSize, "UInt")
NumPut(&Data, COPYDATA, A_PtrSize * 2, "Ptr")
Result := DllCall("User32.dll\SendMessageW", "Ptr", HWND, "UInt", WM_COPYDATA, "Ptr", 0, "Ptr", &COPYDATA, "Ptr")
;MsgBox, %Result%
;MsgBox, %1%

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

Re: File links from other programs + XYplorers PFA.

Post by highend »

Code: Select all

if (exists("%1%") == 2) { //goto folder} elseif ((... == 1) {// open file}
?
One of my scripts helped you out? Please donate via Paypal

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

Re: File links from other programs + XYplorers PFA.

Post by TheQwerty »

Change this:

Code: Select all

Script = :: if (exists("%1%")) {open "%1%";} elseif {tab("new", "%1%");} else {msg "File/Folder %1% Not Found"}
to this:

Code: Select all

Script = :: $i="%1%";$e=exists($i);if($e==1) {open $i;} elseif ($e==2) {tab("new", $i);} else {msg "File/Folder $i Not Found"}
XY treats 0 as false and non-zero as true, so when exists return 1 (for files) or 2 (for folders) the if condition treats them both as true.

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

Re: File links from other programs + XYplorers PFA.

Post by sinilill »

Wow, that was fast, thanks :beer:

Post Reply