Board logo

标题: [转贴] VBScript脚本复制图片到剪切板 [打印本页]

作者: find    时间: 2012-3-18 12:56     标题: VBScript脚本复制图片到剪切板

  1. imgpath="C:\BatHome.jpg" '在此位置输入你的图片绝对路径
  2. temphtm="temp.html"
  3. Set fso=CreateObject("scripting.filesystemobject")
  4. Set fs=fso.CreateTextFile(temphtm)
  5. fs.WriteLine "<Img Src='" & imgPath & "' id='TempImg'></img>"
  6. fs.Close
  7. Set fs=fso.GetFile(temphtm)
  8. Set ie=CreateObject("internetexplorer.application")
  9. ie.Navigate fs.path
  10. ie.Visible=False
  11. Do
  12. WScript.Sleep 100
  13. Loop Until ie.ReadyState=4
  14. Set ctrl = ie.document.body.createControlRange
  15. set oImg = ie.Document.getElementById("TempImg")
  16.     oImg.contentEditable = true
  17.     ctrl.add oImg
  18.     ctrl.execCommand "Copy"
  19.     oImg.contentEditable = false
  20.     ie.Quit
  21. fs.Delete
  22. MsgBox "已经成功复制图片到剪切板"
复制代码
出自某VBS群
作者: powerbat    时间: 2012-3-18 19:34

批处理、VBS剪贴板操作专题
http://www.bathome.net/thread-8329-1-1.html
mshta "javascript:moveTo(screen.width,0);document.write('<img id=\'x\' src=\'%f%\'>');i=document.body.createControlRange();i.add(x);i.execCommand('copy');close()"

我记得这个链接发过几次,某人没看过吗?




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