[javascript FR] Add event property for ESC key, or make Thermometer object respond to ESC

Please post any ideas or requests for new features here for the End User Version of PDF-XChange (printer Drivers)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange, Tracker - Clarion Support, John - Tracker Supp, Support Staff, moderators

User avatar
Mathew
User
Posts: 824
Joined: Thu Jun 19, 2014 7:30 pm

[javascript FR] Add event property for ESC key, or make Thermometer object respond to ESC

Post by Mathew »

Sometimes scripts continue running in the background and we need a way to cancel them. The event object has event.modifier and event.shift both of which are very useful for knowing if those keys are pressed. This FR is to ask for an additional event.esc property (or similar) so a script can know if a user is pressing the ESC key.

I also noticed that the javascript API says that the Thermometer object is supposed to listen for ESC key being pressed and set the .cancelled property if so. I'm not finding that is happening though.
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#id1055

Code: Select all

// test if esc key is listened to by thermometer

async function listenForEsc() {
    // start the thermometer
    const th = app.thermometer;
    th.begin();
    th.text = "This is supposed to close with ESC, but I think it doesn't.";
    th.duration = 1000;
    // start a really long loop
    for (th.value = th.duration; th.value--;) {
        if (th.cancelled) break;
        await app.timeOut(100);
    }
    th.end();
}

listenForEsc();
Last edited by Mathew on Tue Feb 17, 2026 10:26 pm, edited 1 time in total.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12862
Joined: Wed Jan 03, 2018 6:52 pm

Re: [javascript FR] Add event property for ESC key, or make Thermometer object respond to ESC

Post by Daniel - PDF-XChange »

Hello, Mathew

Thank you for the suggestion (and the related possible bug report) I have passed both along to the Dev team for review.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
[email protected]