如何像打字机一样写在同一行?

时间:2016-04-03 12:55:26

标签: batch-file vbscript

我写了这个混合 [Batch / Vbscript] inspired by this code

为了模拟类似打字机的东西!

但是,我无法弄清楚我们怎么能像打字机一样写在同一行?

@echo off
Set Message=Hi ! StackOverFlow !
@cScript.EXE //noLogo "%~f0?.WSF" "%Message%" //job:info %~nx0%*
pause
<job id="info">
<script language="VBScript">
strText=wscript.arguments(0)
intTextLen = Len(strText)
intPause = 100
For x = 1 to intTextLen
    strTempText = Mid(strText,x,1)
    wscript.echo strTempText
    WScript.Sleep intPause
    If intPause <= 500 Then
        intPause = intPause + 100
    Else
        intPause = 100
    End If
Next
</script>
</job>

1 个答案:

答案 0 :(得分:4)

您必须写信至StdOut信息流。

str = "hello world!"
For i = 1 To Len(str)
    WScript.StdOut.Write Mid(str, i, 1)
    WScript.Sleep 50
Next