使用 VBScript 中的剪贴板 [英] Use clipboard from VBScript

查看:27
本文介绍了使用 VBScript 中的剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种使用 VBScript 将一些文本放到剪贴板上的方法.有问题的 VBScript 将作为我们登录脚本的一部分进行部署.我想避免使用在干净的 Windows XP 系统上不可用的任何内容.

I am looking for a method to place some text onto the clipboard with VBScript. The VBScript in question will be deployed as part of our login script. I would like to avoid using anything that isn't available on a clean Windows XP system.

回答有关这是做什么的问题.

In answer to the questions about what this is for.

我们希望鼓励组织内部的用户使用文件服务器来传输文档,而不是经常通过电子邮件发送附件.最大的障碍之一是人们并不总是清楚文件/文件夹的正确网络路径是什么.我们开发了一个快速脚本,并将其附加到 Windows 上下文菜单中,以便用户可以右键单击任何文件/文件夹,并获得一个 URL,他们可以通过电子邮件将其发送给我们组织内的某个人.

We wanted to encourage users inside our organization to use the file server to transfer documents instead of constantly sending attachments by email. One of the biggest barriers to this is that it isn't always obvious to people what the correct network path is to a file/folder. We developed a quick script, and attached it to the Windows context menu so that a user can right click on any file/folder, and get a URL that they can email to someone within our organization.

我希望将对话框中显示的 URL 也放到剪贴板上.

I want the URL displayed in the dialog box to also be placed onto the clipboard.

GetNetworkPath

推荐答案

Microsoft 没有为 VBScript 提供直接访问剪贴板的方法.如果您在 这个 网站你会看到:

Microsoft doesn't give a way for VBScript to directly access the clipboard. If you do a search for 'clipboard'on this site you'll see:

尽管 Visual Basic for Applications 支持 Screen、Printer、App、Debug、Err 和 Clipboard 对象,但 VBScript 仅支持 Err 对象.因此,VBScript 不允许您访问诸如鼠标指针或剪贴板之类的有用对象.但是,您可以使用 Err 对象为您的应用程序提供运行时错误处理.

Although Visual Basic for Applications supports the Screen, Printer, App, Debug, Err, and Clipboard objects, VBScript supports only the Err object. Therefore, VBScript does not allow you to access such useful objects as the mouse pointer or the clipboard. You can, however, use the Err object to provide runtime error handling for your applications.

因此,间接使用记事本可能是您仅使用 VBScript 所能做的最好的事情.

So using notepad indirectly is probably about the best you'll be able to do with just VBScript.

这篇关于使用 VBScript 中的剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆