首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >是否可以在光标中添加沙漏?

是否可以在光标中添加沙漏?
EN

Stack Overflow用户
提问于 2016-02-09 08:49:00
回答 2查看 2.8K关注 0票数 0

我想要一个vbscript.vbs,它将向光标添加一个沙漏,或者将光标完全更改为沙漏,并且在脚本末尾将光标更改为标准模式。

我搜索了很多Google,但是没有找到任何东西,我甚至没有尝试过一行代码。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-02-09 13:05:42

正如他所说的,"destination-data" ==> VBS不包含此功能。

但是,如果将VBScript封装在HTA中,则可以找到解决办法。

这里是HTA中的一个例子

代码语言:javascript
运行
复制
<HTML>
  <HEAD>
    <STYLE>
      .clsAccKey:first-letter {text-decoration: underline}
      BUTTON {width: 15ex}
    </STYLE>
    <SCRIPT language=VBScript>
      Option Explicit

      Sub btnClick_onclick()
        btnClick.disabled = True
        document.body.style.cursor = "wait"
        btnClick.style.cursor = "wait"
        'Long delay here just to simulate a long
        'running process visually for this demo.
        setTimeout "HiThere", 2000, "VBScript"
      End Sub

      Sub HiThere()
        document.body.style.cursor = "default"
        btnClick.style.cursor = "default"
        MsgBox "Hi There!"
        btnClick.disabled = False
      End Sub
    </SCRIPT>
  </HEAD>
  <BODY>
    <BUTTON id=btnClick accessKey=C class=clsAccKey>Click Me</BUTTON>
  </BODY>
</HTML>

我在本例中使用了它:使用HTA执行一个powershell文件

代码语言:javascript
运行
复制
<html>
<head>
<title>Execution a powershell file with HTA by Hackoo</title>
<HTA:APPLICATION 
     APPLICATIONNAME="Execution a powershell file with HTA by Hackoo"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="maximize"
     ICON="Winver.exe"
     SCROLL="no"
/>
<script language="VBScript">
Option Explicit
Sub Run_PS_Script()
    ExampleOutput.value = ""
    btnClick.disabled = True
    document.body.style.cursor = "wait"
    btnClick.style.cursor = "wait"
    Dim WshShell,Command,PSFile,return,fso,file,text,Temp
    Set WshShell = CreateObject("WScript.Shell")
    Temp = WshShell.ExpandEnvironmentStrings("%Temp%")
    Command = "cmd /c echo Get-WmiObject Win32_Process ^| select ProcessID,ProcessName,Handle,commandline,ExecutablePath ^| Out-File %temp%\output.txt -Encoding ascii > %temp%\process.ps1"
    PSFile = WshShell.Run(Command,0,True)
    return = WshShell.Run("powershell.exe -ExecutionPolicy Unrestricted -File %temp%\process.ps1", 0, true)
    Set fso  = CreateObject("Scripting.FileSystemObject")
    Set file = fso.OpenTextFile(Temp &"\output.txt", 1)
    text = file.ReadAll 
    ExampleOutput.Value=text
    file.Close
    document.body.style.cursor = "default"
    btnClick.style.cursor = "default"
    btnClick.disabled = False   
End Sub
</script>
</head>
<body bgcolor="123456">
<textarea id="ExampleOutput" style="width:100%" rows="37"></textarea>
<br>
<center><input type="button" name="btnClick" value="Run powershell script file " onclick="Run_PS_Script()"></center> 
</body>
</html>
票数 0
EN

Stack Overflow用户

发布于 2016-02-09 12:46:59

VBS不包括此功能。

默认情况下,.vbs文件由Windows主机执行,它也不提供更新游标的方法。如果您使用的是另一个主机,这可能会提供一个方法。

假设您正在寻找一种跟踪脚本进度的方法,那么有一些解决办法。

方法1

通过命令行执行脚本提供了一个UI,您可以将进度输出到该UI。

方法2

将您的VBScript封装在HTA中。这将提供一个一个页面的HTML。您可以在这里包含某种进度指示符。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35287497

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档