Menu to Open a File Popup?

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