Page 1 of 1

File links from other programs + XYplorers PFA.

Posted: 13 Jan 2016 17:15
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!

Re: File links from other programs + XYplorers PFA.

Posted: 13 Jan 2016 19:23
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.

Re: File links from other programs + XYplorers PFA.

Posted: 14 Jan 2016 18:19
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%

Re: File links from other programs + XYplorers PFA.

Posted: 14 Jan 2016 18:25
by highend

Code: Select all

if (exists("%1%") == 2) { //goto folder} elseif ((... == 1) {// open file}
?

Re: File links from other programs + XYplorers PFA.

Posted: 14 Jan 2016 18:29
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.

Re: File links from other programs + XYplorers PFA.

Posted: 14 Jan 2016 18:45
by sinilill
Wow, that was fast, thanks :beer: