Menu to Open a File Popup?

I have two Programs that Open PDF Files - "Bluebeam Revu" and "Adobe Acrobat Pro"

"C:\Program Files\Bluebeam Software\Bluebeam Revu\2018\Revu\Revu.exe"
"C:\Program Files (x86)\Adobe\Acrobat\Acrobat.exe"

When I double-click on a PDF File the File will open in whatever the default program is currently.

My question - is there a way to have a selection popup when I double-click on a PDF File which would show both Acrobat and Bluebeam and I could choose which program to use at that time?
.

You could have a popup menu via scripting, but a much easier way would be to add an item for each program to the PDF type's context menu and then right-click the files to choose a program.

(Settings > File Types, to add things to those menus.)

A script would be much better because I always forget to right-click, the script would eliminate that issue. Is it hard to write a script to do this? How much would it cost?

The other issue is opening a file attachment, which doesn't give a choice to open in one of the two programs, it all opens in the default one.

File attachments inside other software? That would be more complicated to solve, if you need it to apply to double-clicks (or other methods of opening the files) outside of Opus.

The only software would be Outlook which I open attachments in. If that is a major scripting issue, I can work without that feature.

This add-in creates a new command LaunchPdf that will do this. You need to add the command in the File Types menu for the .pdf extension.

2022-09-25 2

function OnInit(initData) {
    initData.name = 'LaunchPdf';
    initData.version = '2022-09-26';
    initData.copyright = 'LaunchPdf';
    initData.url = 'https://resource.dopus.com/t/menu-to-open-a-file-popup/42271';
    initData.desc = 'LaunchPdf';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnAddCommands(addCmdData) {
    var cmd = addCmdData.AddCommand();
    cmd.name = 'LaunchPdf';
    cmd.method = 'OnLaunchPdf';
    cmd.desc = 'LaunchPdf';
    cmd.label = 'LaunchPdf';
    cmd.template = '';
    cmd.hide = false;
    cmd.icon = 'script';
}

function OnLaunchPdf(scriptCmdData) {
    var cmd = scriptCmdData.func.command;
    var tab = scriptCmdData.func.sourcetab;
    var dlg = scriptCmdData.func.Dlg();
    var fsu = DOpus.FSUtil();

    cmd.deselect = false;

    if (tab.selected_files.count == 0) return;

    var item = fsu.Resolve(tab.selected_files(0));

    var userChoice = dlg.Request('Open\n\n' + item.name + '\n\nwith', 'Bluebeam Revu|Adobe Acrobat Pro|Cancel');

    if (userChoice == 0) return;

    if (userChoice == 1) {
        var cmdLine = '"C:\\Program Files\\Bluebeam Software\\Bluebeam Revu\\2018\\Revu\\Revu.exe"';
    } else {
        var cmdLine = '"C:\\Program Files (x86)\\Adobe\\Acrobat\\Acrobat.exe"';
    }

    cmdLine += ' "' + item + '"';

    // DOpus.Output(cmdLine);
    cmd.RunCommand(cmdLine);
}

Copy CommandLaunchPdf.js.txt to /scripts (What are aliases?):

Pasting this into Windows' "Save As" dialog will take you directly to the right destination:

%appdata%\GPSoftware\Directory Opus\Script AddIns

3 Likes

I Tried Your Script - Thank You Very Much for Your Time!

Not Sure why none of the scripts I tried will work?

Ah yes... the external programs get confused by Opus' internal file notation... I have updated the script.

Hi lxp - I didn't see the updated script?

Can you tell me why this will not function?

{dlgchoose|Choose Adobe Acrobat or Bluebeam|Default:Adobe="C:\Program Files (x86)\Adobe\Acrobat\Acrobat.exe" "%1"+BlueBeam="C:\Program Files\Bluebeam Software\Bluebeam Revu\2018\Revu\Revu.exe" "%1"}

or this:

{dlgchoose|Choose Adobe Acrobat or Bluebeam|Default:Adobe="C:\Program Files (x86)\Adobe\Acrobat\Acrobat.exe" %1+BlueBeam="C:\Program Files\Bluebeam Software\Bluebeam Revu\2018\Revu\Revu.exe" %1}

It seems to me that one of the above scripts should work?

This simple little script seems like it should work, and it makes a nice little menu.

Drop Menu

Again - Thank you for your help... Joe Colburn

Try:

{dlgchoose|Choose Adobe Acrobat or Bluebeam|Default:Adobe="C:\Program Files (x86)\Adobe\Acrobat\Acrobat.exe"+BlueBeam="C:\Program Files\Bluebeam Software\Bluebeam Revu\2018\Revu\Revu.exe"} {filepath}

But Lxp's script will mean less clicking each time, so I think it's better, even if it's more lines.

The script was updated in the post above.

Thank you so much to you both - both scripts now work PERFECTLY and just what I was looking for!!!

It is a toss-up on which is better because 85% of the time I use Adobe (much quicker response), which would be two-clicks and BlueBeam (awesome for measuring) would be two-clicks plus the dropdown. Lxp's is genuinely nice also and always two-clicks.

I am going to try both for a while and see which one feels the best, because thanks to you two, I can...

Happy Days for Sure - A nuisance in my day is no longer and with this added knowledge, I could become dangerous and fix other things... :rofl:

I wish all the software companies were as Great as the service and responses I always receive from DO...

1 Like

Hi Leo,

I have been using this little pdf script you wrote for me a few months ago and it has worked flawlessly until yesterday. I must use it 30 times a day. Now I receive this error:

I can double-click the PDF in File Exploder and it opens the PDF file correctly. If I use "Open With" in DO it opens the PDF correctly. I am not sure what the heck the problem is, but I sure would love to have my little menu back.

Script:

function OnInit(initData) {
    initData.name = 'LaunchPdf';
//    initData.version = '2022-09-26';
//    initData.copyright = 'LaunchPdf';
//    initData.url = 'https://resource.dopus.com/t/menu-to-open-a-file-popup/42271';
    initData.desc = 'LaunchPdf';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnAddCommands(addCmdData) {
    var cmd = addCmdData.AddCommand();
    cmd.name = 'LaunchPdf';
    cmd.method = 'OnLaunchPdf';
    cmd.desc = 'LaunchPdf';
    cmd.label = 'LaunchPdf';
    cmd.template = '';
    cmd.hide = false;
    cmd.icon = 'script';
}

function OnLaunchPdf(scriptCmdData) {
    var cmd = scriptCmdData.func.command;
    var tab = scriptCmdData.func.sourcetab;
    var dlg = scriptCmdData.func.Dlg();
    var fsu = DOpus.FSUtil();

    cmd.deselect = false;

    if (tab.selected_files.count == 0) return;

    var item = fsu.Resolve(tab.selected_files(0));

    var userChoice = dlg.request('Open With:','Adobe Acrobat Pro|Bluebeam Revu|Cancel');

    if (userChoice == 0) return;

    if (userChoice == 1) {
        var cmdLine =  '"C:\\Program Files (x86)\\Adobe\\Acrobat\\Acrobat.exe"';
    } else {
        var cmdLine = '"C:\\Program Files\\Bluebeam Software\\Bluebeam Revu\\2018\\Revu\\Revu.exe"';

    }

    cmdLine += ' "' + item + '"';

    // DOpus.Output(cmdLine);
    cmd.RunCommand(cmdLine);
}

Joe Colburn (720) 354-8105
Authority Air Designs, LLC.
Joe@AuthorityAir.com

Lxp wrote it, not me. :slight_smile: Although it looks correct.

I've merged this into the original thread, to keep everything in one place.

If Acrobat is showing that error for a file, go to the bottom of the script and remove the // from the DOpus.Output(cmdLine) line:

    // DOpus.Output(cmdLine);
    cmd.RunCommand(cmdLine);
}

Then try the script and open Tools > Script Log to see what it outputs. If the command line is wrong in some way, it should be revealed there.