Board logo

标题: [问题求助] VBS如何把函数的返回值作为变量的值/赋值给变量? [打印本页]

作者: 随风    时间: 2011-2-17 19:38     标题: VBS如何把函数的返回值作为变量的值/赋值给变量?

本帖最后由 pcl_test 于 2017-4-8 05:03 编辑

vbs 如何把命令结果作为变量的值
  1. 想把这句获取前一天日期的值取代下面的"strCopy=的值"
  2. 'wscript.echo dateadd("d",-1,date)
  3. Dim strCopy
  4. strCopy="此处为你要输入的文本"
  5. Call SetClipboardText(strCopy)
  6. Sub SetClipboardText(Text)   '写入信息到剪切板
  7.     Dim wsh
  8.     Set wsh = CreateObject("WScript.Shell")
  9.     wsh.Run "mshta vbscript:ClipboardData.SetData("&chr(34)&"text"&chr(34)&"," &Chr(34)& Text &Chr(34)& ")(close)",0,True
  10.     set wsh=Nothing
  11. End Sub
  12. '下面的是我依葫芦画瓢,虽能完成粘贴动作,但不知有否欠缺,是否应有什么退出语句.望指点.
  13. dim wshshell
  14. set wshshell=createobject("wscript.shell")
  15. wshshell.Sendkeys("^v")
复制代码

作者: 随风    时间: 2011-2-17 23:19

瞎套
  1. Dim strCopy
  2. strCopy=dateadd("d",-1,date)
  3. Call SetClipboardText(strCopy)
  4. Sub SetClipboardText(Text)   '写入信息到剪切板
  5.     Dim wsh
  6.     Set wsh = CreateObject("WScript.Shell")
  7.     wsh.Run "mshta vbscript:ClipboardData.SetData("&chr(34)&"text"&chr(34)&"," &Chr(34)& Text &Chr(34)& ")(close)",0,True
  8.     set wsh=Nothing
  9. End Sub
  10. '模拟按键 粘贴
  11. dim wshshell
  12. set wshshell=createobject("wscript.shell")
  13. wshshell.Sendkeys("^v")
复制代码





欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2