Confirm() doNotAskPref reset?

(For this question, I promise that I’m running the actual confirm() method, and not the alert() method. :slight_smile:)

I created a test userscript consisting of only the following line of code:
require( "ko/dialogs" ).confirm( "confirm(): doNotAskPref", { doNotAskPref: true } );

When I ran it the first time, it of course included the checkbox labeled “Don’t ask me again.” I enabled the checkbox and dismissed the dialog. Running the userscript again, the dialog was not shown, as expected. Naturally, I began to wonder how I could make it appear again. I restarted Komodo IDE normally, but that didn’t reset the dialog so it would appear again. I then rebooted my laptop (this is Windows, after all…). Even that didn’t reset the dialog. When working on a different issue, I restarted in safe mode, and that did the trick, i.e., running the userscript resulted in the dialog being shown.

I’m assuming that there is a far easier way to reset dialogs like this for which the user has clicked that checkbox. Any ideas? I did a search, but couldn’t find anything possibly related except deleting C:\Users[user]\AppData\Local\ActiveState\KomodoIDE\11.0\doc-state.xmlc, and that didn’t work.

@mjross the documentation is a bit wrong here, it says a Boolean. But if you want to use the doNotAskPref you should insert a unique string here:

var prefs = require("ko/prefs");

require( "ko/dialogs" ).confirm( "Confirm me please", { doNotAskPref: 'uniquePrefName' } );


console.log(prefs.getBoolean('donotask_uniquePrefName')); // Looks if the pref is set
console.log(prefs.getStringPref('donotask_action_uniquePrefName')); // The stored action ok/cancel

If you want the dialog to show again, you will have to reset the pref:

var prefs = require("ko/prefs");
prefs.setBoolean('donotask_uniquePrefName', false);

@babobski, thanks for your reply and the sample code. Prior to reading it, I wasn’t aware of the Komodo prefs system. That info is very helpful.

1 Like

@babobski, correct. Could you file a bug to update the docs? Sign in to GitHub · GitHub

@mjross, you’re not reading the docs fast enough :P. JK. Note that there are two other “storage” modules you can use for userscripts:

You’ll most likely want to use those in a userscript. There should be a brief explanation of when it’s appropriate to use which in the modules themselves.

No worries on filing the docs bug, I’ve fixed it on master.

Btw @mjross you might also be interested in http://docs.activestate.com/komodo/11/sdk/api/module-ko_modal.html

1 Like

But it’s true! That’s what happens when I try to time-slice between learning Komodo IDE and learning Spanish. :slight_smile:

I’ll definitely check it out. Thanks.