安装打印机 [英] Install printer
问题描述
我正在尝试使用以下代码使用CEWP添加安装打印功能。在运行调试器时它给我'AddP'没有定义。
I'm trying to add an install print functionality using CEWP with the below code. On running debugger it gives me 'AddP' is not defined.
<html>
<head>
<script type="text/vbscript">
function AddP(pName)
msgbox "Start"
Set WshNetwork = CreateObject("Wscript.Network")
WshNetwork.AddWindowsPrinterConnection pName
msgbox "Finished"
end function
</script>
</head>
<body>
<a href='#' language="vbscript" onclick="AddP('\\Home-PC\HP Photosmart 3300 series')">Add printer</a>
</body>
</html>
我试图关注此链接:https://blogs.msdn.microsoft.com / mab / 2009/02/13 / install-a-remote-printer-via-a-hyperlink-in-html /
I was trying to follow this link:https://blogs.msdn.microsoft.com/mab/2009/02/13/install-a-remote-printer-via-a-hyperlink-in-html/
推荐答案
请尝试将以下代码添加到内容编辑器Web部件中以检查它是否有效。
Please try to add the following code into content editor web part to check if it works.
<script type="text/vbscript">
function AddP(pName)
msgbox "Start"
Set WshNetwork = CreateObject("Wscript.Network")
WshNetwork.AddWindowsPrinterConnection pName
msgbox "Finished"
end function
</script>
<a language="vbscript" onclick="AddP('\\Home-PC\HP Photosmart 3300 series')" href="#">Add printer</a>
如果要在SharePoint网站页面中显示网络共享和网络打印机列表,我们可以使用页面查看器Web部件来实现它。
If you want to show a network share and a list of network printers in SharePoint site page, we can use Page Viewer web part to achieve it.
1.添加页面查看器页面的Web部件。
1.Add the Page Viewer web part to a page.
2.配置Web部件,选择"文件夹"。在选项和复制粘贴网络路径到"链接" textbox。
2.Configure the web part, choose "Folder" in the options and copy paste the network path to the "Link" textbox.
更多信息请点击此处:
最好的问候,
丹尼斯
这篇关于安装打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!