我无法弄清楚如何在注册表字符串中执行此操作,所以我最终编写了一个 Powershell 脚本并只是调用它而不是 UCADialer.exe。
这是我提出的HKCU\Software\Classes\callto\shell\open\command\(Default)
:
"C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe" -file "C:\programmes\click2call.ps1" "%1"
然后我在其中创建了一个新的文本文件C:\Programmes
并click2call.ps1
用这些内容命名(见下文)。详情见右侧评论。
$ThingClicked=$args[0] #saves the thing you clicked on as $ThingClicked (passed in through "%1" in registry string)
$OutsideLinePrefix="8" #in case you have to dial a number to get an outside line. We have to dial 8
$CountryCode="1" #in case you have to dial a country code. Our links usually don't have the country code
#Put the path to UCADialer.exe in the row below:
$PathtoUCADialer="C:\Program Files (x86)\Mitel\Unified Communicator Advanced 6.0\ucadialer.exe"
function DialwithUCA($RawNumber) #defines the DialwithUCA function as the next five rows:
{
$NumeralsOnly=$RawNumber -replace "\D" #removes everything in $RawNumber that isn't a numeral
$NumberToDial=$OutsideLinePrefix + $CountryCode + $NumeralsOnly #Here, you can remove $OutsideLinePrefix and/or $CountryCode here if you don't need them
& $PathtoUCADialer $NumberToDial #launches UCADialer.exe and feeds it the phone number to dial
}
DialwithUCA($ThingClicked) #runs the DialwithUCA function on the thing you clicked.
该脚本获取您单击的任何内容,删除所有不是数字的内容,附加81
到开头,然后将其发送到 UCADialer.exe。$OutsideLinePrefix + $CountryCode +
如果不需要 81,可以在第 11 行删除。
此脚本仅适用于没有国家代码的链接。您可以添加更多逻辑来帮助它始终正确格式化字符串;例如,一些电话链接的开头已经有一个“1”,而另一些则没有。我还没有弄清楚如何做到这一点,但这篇博文看起来很有希望。