我構建了我與您共享的這個腳本,這些腳本在我的Windows 7計算機上完美工作,以便通過我的Yealink VOIP電話在網頁中獲取電話: - 鏈接。通過在註釋中看到的'reg-file',我激活了我的腳本的tel-link uasage。但是現在在Windows 10中,我無法讓它繼續工作!任何人都可以幫助我如何在Windows 10中再次將瀏覽器中的「電話鏈接」鏈接到我的腳本?在Windows 10中註冊定製電話/ callto應用程序
/*
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");
*/
歡迎來到Stack Overflow!雖然這可能會在理論上回答這個問題,[這將是更可取的](// meta.stackoverflow.com/q/8259)在這裏包括答案的基本部分,並提供參考鏈接。 – Takarii