Board logo

标题: [问题求助] 用opera调用VBS打开相对路径下的网页的问题 [打印本页]

作者: batsealine    时间: 2013-2-2 01:59     标题: 用opera调用VBS打开相对路径下的网页的问题

本帖最后由 batsealine 于 2013-2-2 10:08 编辑

这是卡饭一牛人写的
  1. Set objShell = CreateObject("Wscript.Shell")
  2. a = WScript.ScriptFullName
  3. b = Left(a,Len(a) - Len(WScript.ScriptName))
  4. Set objHTML=CreateObject("htmlfile")
  5. c=objHTML.ParentWindow.ClipboardData.GetData("text")
  6. If c = "1" Then
  7. c = "皮肤图标查看.mht"
  8. d = "opera.exe file://localhost/" & b & c
  9. ElseIf c = "2" Then
  10. c = "按钮制作工具.mht"
  11. d = "opera.exe file://localhost/" & b & c
  12. ElseIf c = "3" Then
  13. c = "首选项.mht"
  14. d = "opera.exe file://localhost/" & b & c
  15. ElseIf c = "4" Then
  16. c = "web\"
  17. d = "opera.exe file://localhost/" & b & c
  18. ElseIf c = "5" Then
  19. c = "web\"
  20. d = "C:\Windows\explorer.exe" & " " & b & c
  21. ElseIf c = "6" Then
  22. c = "fs.html"
  23. d = "opera.exe file://localhost/" & b & c
  24. ElseIf c = "" Then
  25. c = "web\"
  26. d = "opera.exe file://localhost/" & b & c
  27. ElseIf c = "" Then
  28. c = "profile\"
  29. d = "C:\Windows\explorer.exe" & " " & b & c
  30. End If
  31. objShell.Run d
  32. 'Set objShell = CreateObject("Wscript.Shell")
  33. a = WScript.ScriptFullName
  34. b = Left(a,Len(a) - Len(WScript.ScriptName))
  35. Set objHTML=CreateObject("htmlfile")
  36. c=objHTML.ParentWindow.ClipboardData.GetData("text")
  37. If c = "1" Then
  38. c = "皮肤图标查看.mht"
  39. d = "opera.exe file://localhost/" & b & c
  40. ElseIf c = "2" Then
  41. c = "按钮制作工具.mht"
  42. d = "opera.exe file://localhost/" & b & c
  43. ElseIf c = "3" Then
  44. c = "首选项.mht"
  45. d = "opera.exe file://localhost/" & b & c
  46. ElseIf c = "4" Then
  47. c = "web\"
  48. d = "opera.exe file://localhost/" & b & c
  49. ElseIf c = "5" Then
  50. c = "web\"
  51. d = "C:\Windows\explorer.exe" & " " & b & c
  52. ElseIf c = "6" Then
  53. c = "seam\fs.html"
  54. d = "opera.exe file://localhost/" & b & c
  55. ElseIf c = "" Then
  56. c = "web\"
  57. d = "opera.exe file://localhost/" & b & c
  58. ElseIf c = "" Then
  59. c = "profile\"
  60. d = "C:\Windows\explorer.exe" & " " & b & c
  61. End If
  62. objShell.Run d
  63. '其中的文件和文件夹与VBS在同一目录
复制代码
调用它的opera命令为
  1. Focus address field & Clear & Insert, "4" & Delay, 10 & Select all & Cut & Execute program, "optools\document.vbs"
  2. 命令解释: 聚焦地址栏 & 清空 & 输入4 & 延迟10 & 选中4 & 剪切 & 调用VBS
  3. 结果: 在新标签中打开web文件夹(为何会在新标签中打开有点费解,因为若直接复制全路径再enter是在当前标签打开)
复制代码
问题: 每次运行命令后剪贴板里的东西会改变,希望有高手能将其改进,让opera直接传递参数给VBS,其格式为Execute program, "程序路径以及程序名", "参数"。不过要是VBS不能接收opera参数,我希望先 Execute program, "optools\document_start\1.vbs",再用1.vbs调用document.vbs打开第一个选项即“皮肤图标查看.mht”
作者: Demon    时间: 2013-2-2 09:39

http://bbs.kafan.cn/thread-1370407-1-1.html

连命令行参数都不会用,果然是牛人




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