我在这里建立了这个与你共享的脚本,这个脚本在我的Windows 7计算机上运行得很好,可以在我的Yealink VOIP手机的网页中使用tel:-link。使用'reg-file',你在评论中看到我激活了我的脚本的tel-link uasage。但现在在Windows 10中我无法再让它工作了!任何人都可以帮助我如何在Windows 10中将浏览器中的“tel link”链接到我的脚本?
/*
test usage: cscript Z:\tel_link_open\tel.js [phone number]
create register_me.reg with:
REGEDIT4
[HKEY_CLASSES_ROOT\tel]
@="URL:knoop.frl Custom Telephone Protocol for VoIP phone"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\tel\shell]
[HKEY_CLASSES_ROOT\tel\shell\open]
[HKEY_CLASSES_ROOT\tel\shell\open\command]
@="cscript \"Z:\\tel_link_open\\tel.js\" -c \"\\%1\""
*/
var call_number = WScript.Arguments(0);
call_number = call_number.replace(/\|.+/g,'');
// spatie -.
call_number = call_number.replace(/(\\tel:|%20|\(|\)|[a-z:\\ -]+)/g,'');
// + 31 ( 0 )
call_number = call_number.replace(/(\+|%2b)([0-9]+)(\(|%28)0(\)|%29)/ig,'00$2');
call_number = call_number.replace(/^0031/ig,'0');
WScript.Echo("\n\nGoing to dail: " + call_number + "\n\n");
//WScript.Sleep(50000000);
var outgoing_uri = "31"+"513"+"[number]"+"[internal extension]";
var login_name = "XXX";
var login_pass = "yyy";
var get_url = "http://192.168.xx.yy/servlet?number=" + call_number + "&outgoing_uri=" + outgoing_uri;
// Load the WinHttpRequest object.
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
// HttpRequest SetCredentials flags
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0;
// Specify the target resource.
WinHttpReq.open( "GET",
get_url,
false );
if (login_name.length) { // Set credentials for server.
WinHttpReq.SetCredentials( login_name,
login_pass,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER);
}
// It might also be necessary to supply credentials
// to the proxy if you connect to the Internet
// through a proxy that requires authentication.
// Send a request to the server and wait for
// a response.
WinHttpReq.send( );
// Display the results of the request.
WScript.Echo( "Result status: " + WinHttpReq.Status + " " + WinHttpReq.StatusText + "\n");
WScript.Echo( WinHttpReq.GetAllResponseHeaders( ) );
/* To save a binary file use this code instead of previous line
BinStream = new ActiveXObject("ADODB.Stream");
BinStream.Type = 1;
BinStream.Open();
BinStream.Write(WinHttpReq.ResponseBody);
BinStream.SaveToFile("out.bin");
*/
答案 0 :(得分:0)
我认为您可以在MSDN Microsoft找到解决方案:
*注册处理自定义URI方案的应用程序 要注册应用程序以处理特定的URI方案,请将新密钥以及相应的子键和值添加到HKEY_CLASSES_ROOT。根密钥必须与要添加的URI方案匹配。例如,要添加方案,请将[Protocol Name]键添加到HKEY_CLASSES_ROOT,如下所示:
HKEY_CLASSES_ROOT
[议定书名称]
URL协议=“”
在此新密钥下,URL协议字符串值指示此密钥声明了自定义可插入协议处理程序。如果没有此密钥,处理程序应用程序将无法启动。该值应为空字符串
...
当用户单击包含您的自定义URI方案的链接时,Windows Internet Explorer将启动为该URI方案注册的可插入协议处理程序。如果注册表中指定的指定open命令包含%1参数,则Internet Explorer会将URI传递给已注册的可插入协议处理程序应用程序。*
进一步详情见
Registering an Application to a URI Scheme
这适用于tel-URI,但是callto-URI是Skype注册的地方。您必须在注册表中搜索它并在那里添加您的应用程序。