我在注册表中存储了一个网站。例如:
SOFTWARE\Microsoft\Internet Explorer\Default Website
键名:Website
键值:www.google.com/
然后我尝试在IE中创建搜索插件。 以下是我用于此的代码。当我对其进行硬编码时,它适用于Google, 但我想使用注册表值来设置此变量。
<html>
<script language="VBSCRIPT">
set parentwin = external.menuArguments
str = trim(parentwin.document.selection.createRange().text)
bnewwindow = parentwin.event.shiftKey
defaultWebsite = ????????
url = defaultWebsite +"search?q=" + escape(str)
if(bnewwindow) then
window.open(url)
else
parentwin.window.navigate(url)
end if
</script>
</html>
答案 0 :(得分:0)
You can use the Shell
object to read and write registry values. You may get a warning in Internet Explorer when trying to instantiate an ActiveX control, since this requires access to the client PC.
' This uses HKCU. Change to HKLM, if you need.
Dim strKey = "HKCU\Software\Microsoft\Internet Explorer\Default Website\Website"
With CreateObject("WScript.Shell")
defaultWebsite = .RegRead(strKey)
End With