Page 1 of 1

Open File Type - Different Programs

Posted: 06 Oct 2021 22:35
by Insecure
Hello,

I am new to XYPlorer. I am looking to solve a problem I have.

I would like to be able to open PDF documents with two different programs, based off the file path. The situation at hand is I work for a company that has a site to site VPN to our factory in the country of Belgium. I am in the United States. So when I open a PDF from Belgium in Foxit it loads choppy. If I open in Google Chrome, it loads nice and fast.

So I would like to open files from a shared drive (mapped network drive) in Chrome and local files in my windows default.

Any ideas?

Re: Open File Type - Different Programs

Posted: 06 Oct 2021 22:56
by highend
Save the attached .xys document in your XYplorer scripts folder (use the same name)
Open it with a texteditor and adapt the mapped drive letter and the path to chrome
Open pdf.xys
Create a CFA (Customize File Association) entry at the top of the list:
"Open pdf" pdf>::load "Open pdf.xys";

Re: Open File Type - Different Programs

Posted: 06 Oct 2021 23:49
by Insecure
Thank you for the prompt reply.

Not to be difficult but is it possible to map more than one drive letter to open the special way? I have 6 drives that I would like to do this with.

Thank you so much!

Re: Open File Type - Different Programs

Posted: 06 Oct 2021 23:54
by highend
Why didn't you say that in the first place?...

Code: Select all

    $mapped = <<<>>>
F:
G:
H:
X:
Y:
Z:
    >>>;
    $chrome = "path to chrome\chrome.exe";
    end (exists($chrome) != 1), quote($chrome) . <crlf 2> . "not found, aborted!";

    $drive = gpc(<curitem>, "drive") . ":";
    if (regexmatches($mapped, "^$drive")) { run """$chrome"" ""<curitem>"""; }
    else { run """<curitem>"""; }

Re: Open File Type - Different Programs

Posted: 07 Oct 2021 00:04
by Insecure
Because I am not smart. Sorry.

The first code worked but this one is giving me a script error.

Re: Open File Type - Different Programs

Posted: 07 Oct 2021 00:10
by highend
Remove the // Drive letter... comment on that line

Re: Open File Type - Different Programs

Posted: 07 Oct 2021 00:52
by Insecure
Thank you so much!!!