Marc, I've stolen your InputBox code for one of my scripts, but I can't get it to work properly:
var vb = new ActiveXObject('ScriptControl');
vb.Language = 'VBScript';
function InputBox(message, title, value) {
message = message.replace(/"/g, '" + Chr(34) + "');
message = message.replace(/\n/g, '" + Chr(13) + "');
title = title.replace(/"/g, '" + Chr(34) + "');
value = value.replace(/"/g, '" + Chr(34) + "');
var temp_value = vb.eval("InputBox" + "(\"" + message + "\", \"" + title + "\", \"" + value + "\")");
return typeof temp_value == "undefined" ? value : temp_value.trim();
}
val = InputBox("This is a test", "test", "");
The temp_value.trim() instruction crashes with the "Object doesn't support this property or method" error message. Seems the string returned by vb.eval() is not a regular string object.
However, InputBox() works fine in your autoplaylists script, so I suppose I've missed something in your code (or in common2.js), but I don't know what. Can you help?
And BTW, have you noticed that InputBox lets you type as many characters as you want, but it silently truncates the string after 254 characters? It's a real problem with some of my playlists. For example, the autoplaylist "Related to Hatfield and the North" needs this query (312 characters):ARTIST HAS "Hatfield and the North" OR ALBUM ARTIST HAS "Hatfield and the North" OR COMPOSER HAS "Hatfield and the North" OR PERFORMER HAS "Hatfield and the North" OR COMMENT HAS "Hatfield and the North" OR DISCOGS_ALBUM_CREDITS HAS "Hatfield and the North" OR DISCOGS_TRACK_CREDITS HAS "Hatfield and the North"
Do you know a solution, or is it a VisualBasic limitation?