Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Search 使用VB脚本读取注册表项值_Search_Plugins_Vbscript - Fatal编程技术网

Search 使用VB脚本读取注册表项值

Search 使用VB脚本读取注册表项值,search,plugins,vbscript,Search,Plugins,Vbscript,我在注册表中存储一个网站。例如: SOFTWARE\Microsoft\internetexplorer\Default网站 关键字名称:网站 键值:www.google.com/ 然后我尝试在IE中创建搜索插件。 下面是我使用的代码。当我硬编码它时,它对谷歌有效, 但是我想使用注册表值来设置这个变量 <html> <script language="VBSCRIPT"> set parentwin = external.menuArguments st

我在注册表中存储一个网站。例如:

  • SOFTWARE\Microsoft\internetexplorer\Default网站

  • 关键字名称:
    网站

  • 键值:
    www.google.com/

  • 然后我尝试在IE中创建搜索插件。 下面是我使用的代码。当我硬编码它时,它对谷歌有效, 但是我想使用注册表值来设置这个变量

    <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>
    
    
    设置parentwin=external.menuArguments
    str=trim(parentwin.document.selection.createRange().text)
    bnewwindow=parentwin.event.shiftKey
    默认网站=????????
    url=defaultWebsite+“搜索?q=“+escape(str)
    如果(b新窗口)那么
    打开窗口(url)
    其他的
    parentwin.window.navigate(url)
    如果结束
    
    您可以使用
    Shell
    对象读取和写入注册表值。在尝试实例化ActiveX控件时,您可能会在Internet Explorer中收到警告,因为这需要访问客户端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
    

    您可以使用
    Shell
    对象读取和写入注册表值。在尝试实例化ActiveX控件时,您可能会在Internet Explorer中收到警告,因为这需要访问客户端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