Shoutbox

[?] what is this! help to find default browser :O - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [?] what is this! help to find default browser :O (/showthread.php?tid=69551)

[?] what is this! help to find default browser :O by roflmao456 on 12-16-2006 at 06:04 AM

almost done the Youtube viewer.. but need help on this part.

i want to open a program ( IE ) which is opening a webpage on the script files path but it keeps showing an error that it cant find...

my Code:

code:
var Browser = "C:\Program Files\Internet Explorer\iexplore.exe";
function viewVideo(){
var Browser = TubeOption.RegRead(TubeBrowser); (dont mind that)
var Opener = new ActiveXObject("Shell.Application");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.CreateTextFile(MsgPlus.ScriptFilesPath + "\\Viewer.html", true);
var code = "<HTML>\n";
code += "<TITLE>YouTube Video: "+video+"</TITLE>\n";
code += "<BODY style='background:black'>\n";
code += "<Center><object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/"+video+"\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/"+video+"\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object></Center>\n";
code += "</BODY>\n";
code += "</HTML>";
file.WriteLine(code);
Opener.ShellExecute("\""+Browser+"\"  "+MsgPlus.ScriptFilesPath+"\\Viewer.html","","","open",1);
file.WriteLine(" ");
file.Close();
}

what did i do wrong?
[code][/code]
RE: [?] what is this! omg anyone help; problem ehre by Felu on 12-16-2006 at 06:34 AM

code:
var Browser = "C:\\Program Files\\Internet Explorer\\iexplore.exe";
function viewVideo(video){
//var Browser = TubeOption.RegRead(TubeBrowser); (dont mind that)
var Opener = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.CreateTextFile(MsgPlus.ScriptFilesPath + "\\Viewer.html", true);
var code = "<HTML>\n";
code += "<TITLE>YouTube Video: "+video+"</TITLE>\n";
code += "<BODY style='background:black'>\n";
code += "<Center><object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/"+video+"\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/"+video+"\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object></Center>\n";
code += "</BODY>\n";
code += "</HTML>";
file.WriteLine(code);
Opener.Run("\""+Browser+"\"  \""+MsgPlus.ScriptFilesPath+"\\Viewer.html\"");
file.WriteLine(" ");
file.Close();
}
You can open the same in the default browser too
code:
function viewVideo(video){
var Shell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.CreateTextFile(MsgPlus.ScriptFilesPath + "\\Viewer.html", true);
var code = "<HTML>\n";
code += "<TITLE>YouTube Video: "+video+"</TITLE>\n";
code += "<BODY style='background:black'>\n";
code += "<Center><object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/"+video+"\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/"+video+"\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object></Center>\n";
code += "</BODY>\n";
code += "</HTML>";
file.WriteLine(code);
Shell.Run(MsgPlus.ScriptFilesPath+"\\Viewer.html");
file.WriteLine(" ");
file.Close();
}

RE: [?] what is this! omg anyone help; problem ehre by Matti on 12-16-2006 at 10:16 AM

To explain your mistake which Felu has corrected:

A backslash (ASCII code 92) in a string tells JScript that the following character is a special character. (like \n for a new line or \t for a tab space) When you want a literally backslash in your string, you have to escape it using a second backslash, like \\. If you don't, you get such errors. :)

And by the way, if you want it to open in IE and not in your default browser, you can just use:

code:
Opener.Run("iexplore.exe \""+MsgPlus.ScriptFilesPath+"\\Viewer.html\"");
instead of using the full path. ;)
RE: [?] what is this! omg anyone help; problem ehre by Spunky on 12-16-2006 at 11:06 AM

Bit off topic, but can you pleasebe a bit more descriptive in your thread titles so we know more about the error without having to read the thread