DO11 OnDoubleClick = 'true'; not working with JScript

In VB-Script the simple line OnDoubleClick = true prevents the standard double-click action as leo demonstrated in his Launch M3U playlist when music folder double-clicked Script. When trying this using JScript with OnDoubleClick = "true"; (or several syntax variations) I can't get it working. The standard double-click action is always be executed although the output confirms OnDoubleClick is set to be "true". Is this a bug or just the wrong syntax?

Here's my simple Test-Script AddIn:

[code]// Test
//
//
// This is a script for Directory Opus.
// See http://www.gpsoft.com.au/redirect.asp?page=scripts for development information.
//
//
//
// Called by Directory Opus to initialize the script
function OnInit(initData)
{
initData.name = "Test";
initData.desc = "";
initData.copyright = "";

}

// Called when a file or folder is double-clicked
function OnDoubleClick(doubleClickData)
{
OnDoubleClick = "true";
if (OnDoubleClick == "true")
DOpus.Output ("true");
}[/code]

"true" is a string, true is a bool.

You probably also want

return true;

in JavaScript. The syntax for functions returning values is very different between the two languages (or between VBScript and just about anything else, for that matter).

Yeah, return true; did the trick. Thanks leo. Only removing the quotes didn't work.

Kundal, that code looks interesting. Could you post an updated version here, please?

What I posted in my first post is just a code snippet. I needed this for a Script-AddIn that Sasa requested in the german forum. You can find the result here: Texteditor bei Doppelklick auswählen (Dialog).
Note that it's just sort of a template that opens a dialog every time you double-click on a *.txt-file (or *.ini-file in the example) where you can choose if you want to open the file with Notepad or WordPad. I don't think that anyone would use it as it is. Sasa wanted to use it with e.g. *.reg-files and other filetypes to decide wether to edit or execute them.

Here's the Script-AddIn TextEditorChoice:

[code]// TextEditorChoice-JS
// (c) 2014 Kundal
//
// This is a script for Directory Opus.
// See http://www.gpsoft.com.au/redirect.asp?page=scripts for development information.
//
//
//
// Called by Directory Opus to initialize the script
function OnInit(initData)
{
initData.name = "TextEditorChoice-JS";
initData.desc = "Open TXT- or INI-file with Notepad or WordPad";
initData.copyright = "(c) 2014 Kundal";
initData.version = "v1.1";
initData.default_enable = true;
}

// Called when a file or folder is double-clicked
function OnDoubleClick(doubleClickData)
{
var wordpad = "/programfiles\Windows NT\Accessories\wordpad.exe";
var ext = doubleClickData.item.ext

// Do nothing if the filetype isn't ".txt" or ".ini"
if (!(ext == ".txt" || ext == ".ini")) return;

// Create Dialog
dlg = DOpus.Dlg;
dlg.window = DOpus.Listers(0);
dlg.message = "Open File with Notepad oder WordPad";
dlg.title = "Choose Editor";
dlg.buttons = "Notepad|WordPad|Abbrechen";
i = dlg.show;

// Configure actions for filtype ".txt"
if (ext == ".txt" == true)
{
if (i == 1)
DOpus.NewCommand.RunCommand('notepad.exe "%1"');
if (i == 2)
DOpus.NewCommand.RunCommand('wordpad "%1"');
}
// Configure actions for filetype ".ini" (for testing purposes simply do reverse actions configured for ".txt")
else if (ext == ".ini" == true)
{
if (i == 1)
DOpus.NewCommand.RunCommand('wordpad "%1"');
if (i == 2)
DOpus.NewCommand.RunCommand('notepad.exe "%1"');
}

// Prevent the standard double-click action.
OnDoubleClick = true; return true;
}[/code]

Sorry, i meant Leo´s script. It doesn´t work for me yet, though. I changed the path to M: in the configuration, have a test m3u in the folder, thumbnails mode,
but no player is fired up. It should be foobar in this case, which is assigend to open m3us.

I'm not sure but try using M:\ instead of M: in case it's because of that.

It's also possible I made an error and it doesn't work at the root of a drive, since I don't think I tested that case.

Actually, there is no music directly under M: (tried both variants with M:\ too), but the music is in some category sub folders like rock, blues, punk, etc.
I also tried M:* & some other variants. Interesting idea, even though i hardly have M3Us in my music collection. Maybe this idea could be taken further,
to work even without any playlists present?