Open File Type - Different Programs

Discuss and share scripts and script files...
Post Reply
Insecure
Posts: 4
Joined: 06 Oct 2021 22:32

Open File Type - Different Programs

Post 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?

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

Re: Open File Type - Different Programs

Post 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
(709 Bytes) Downloaded 80 times
Create a CFA (Customize File Association) entry at the top of the list:
"Open pdf" pdf>::load "Open pdf.xys";
One of my scripts helped you out? Please donate via Paypal

Insecure
Posts: 4
Joined: 06 Oct 2021 22:32

Re: Open File Type - Different Programs

Post 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!

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

Re: Open File Type - Different Programs

Post 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>"""; }
One of my scripts helped you out? Please donate via Paypal

Insecure
Posts: 4
Joined: 06 Oct 2021 22:32

Re: Open File Type - Different Programs

Post by Insecure »

Because I am not smart. Sorry.

The first code worked but this one is giving me a script error.
Attachments
Screenshot 2021-10-06 170348.png
Screenshot 2021-10-06 170348.png (51.39 KiB) Viewed 1033 times
Screenshot 2021-10-06 170319.png
Screenshot 2021-10-06 170319.png (36.56 KiB) Viewed 1033 times

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

Re: Open File Type - Different Programs

Post by highend »

Remove the // Drive letter... comment on that line
One of my scripts helped you out? Please donate via Paypal

Insecure
Posts: 4
Joined: 06 Oct 2021 22:32

Re: Open File Type - Different Programs

Post by Insecure »

Thank you so much!!!

Post Reply