EmEditor Text Editor Forum Index
   Macro Samples
     A Macro Opening Web Browser for Testing
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
antmary
Posted on: 11/4/2009 7:08 am
Just popping in
Joined: 6/3/2009
From:
Posts: 1
A Macro Opening Web Browser for Testing
TestOnServer.jsee:

/* Test On Server script by antmary@126.com
  4th, Jun 2009 */

var root_dir = "d:\\www";
/* web server root directory */
var server_baseurl = "http://localhost";
/* server url to root */

var root_regex = new RegExp("^"+root_dir.replace("\\","\\\\"),"i");
var file_path = document.FullName;
if (!document.saved) {
	alert("Please save the document first!");
} else if (!root_regex.test(file_path)) {
	alert("File is not in the root directory!");
} else {
	var url = server_baseurl + file_path.replace(root_regex, "").replace(/\\/gi,"/");
	OpenBrowser(url);
}

function OpenBrowser(url) {
	var wshShell = new ActiveXObject("WScript.Shell");
	wshShell.Run(url);
}

i hope it helps
ToadLoadin
Posted on: 11/4/2009 6:43 pm
Just can't stay away
Joined: 7/4/2008
From: China
Posts: 76
Re: A Macro Opening Web Browser for Testing
It's really helpful, and very inovative.
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 
English čeština Deutsch español français italiano 日本語 Русский