PDF Explorer > General

Using Custom Scripts with PDF View mode

<< < (2/4) > >>

RTT:
Technically possible to do it internally. Still not possible to do it from a script. I still need to implement the send command to host thing  :)

Padanges:
Do you consider it making a new feature for the next release? :)

Padanges:
Could you make it possible to send the "open in Images mode" command as well?

RTT:
I've now implemented a SendHostCommand method and some commands.
Here's some dumb test code, so you can get the idea how it will work.

--- Code: ---function SelectFilesHostCmd() {
    this.Command = 'GridSelectFiles';
    this.Files = [];
    this.toString = function() {
        return JSON.stringify(this);
    }
};

function UnselectAllHostCmd() {
    this.Command = 'GridUnselectAll';
    this.toString = function() {
        return JSON.stringify(this);
    }
}

function OpenFileHostCmd() {
    this.Command = 'OpenFile';
    this.Filename = '';
    this.Mode = 0; //QuickPDFView=0,QuickPDFEdit=1,OnGridPreview=2,ViewImages=3,ExternalApp=4
    this.toString = function() {
        return JSON.stringify(this);
    }
}

UnselectAll = new UnselectAllHostCmd;
pdfe.sendhostcommand(UnselectAll);

var SelectFilesCmd = new SelectFilesHostCmd();
for (var i = 0; i < pdfe.SelectedFiles.Count; i += 2) {
    SelectFilesCmd.Files.push(pdfe.SelectedFiles(i).filename);
}

if (SelectFilesCmd.Files.length > 0) {
    var n = pdfe.sendhostcommand(SelectFilesCmd);
    if (n != SelectFilesCmd.Files.length) pdfe.echo('some not selected');
}

var OpenFileCmd = new OpenFileHostCmd;
for (var i = 0; i < pdfe.SelectedFiles.Count; i++) {
    var file = pdfe.SelectedFiles(i);
    if (file.filename.indexOf('moby') > 0) {
        OpenFileCmd.Filename = file.filename;
        OpenFileCmd.Mode = 0;
        pdfe.sendhostcommand(OpenFileCmd);
        pdfe.alert('Next');
        OpenFileCmd.Mode = 1;
        pdfe.sendhostcommand(OpenFileCmd);
        pdfe.alert('Next');
        OpenFileCmd.Mode = 2;
        pdfe.sendhostcommand(OpenFileCmd);
        pdfe.alert('Next');
        OpenFileCmd.Mode = 3;
        pdfe.sendhostcommand(OpenFileCmd);
        pdfe.alert('Next');
        OpenFileCmd.Mode = 4;
        pdfe.sendhostcommand(OpenFileCmd);
        break;
    }
}

--- End code ---
Let me know about other commands you think will be useful.

Padanges:
OK. This will be helpful, once the code will be implemented.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Reply

Go to full version