MSGbox in VBS that updates with value of variable

后端 未结 4 1075
别那么骄傲
别那么骄傲 2020-12-02 00:44

Just wondering how i could have a MSgbox that displays the value of a variable as it constantly changes. Basically a number has one added to it everytime it loops. I want to

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 01:33

    One more solution, uses HTA window, without temp files:

    dim window, i
    
    set window = createwindow()
    window.document.write "Current loop is: "
    window.document.title = "Processing..."
    window.resizeto 300, 150
    window.moveto 200, 200
    
    for i = 0 to 32767
        show i
        ' your code here
    next
    
    window.close
    
    function show(value)
        on error resume next
        window.output.innerhtml = value
        if err then wscript.quit
    end function
    
    function createwindow()
        ' source http://forum.script-coding.com/viewtopic.php?pid=75356#p75356
        dim signature, shellwnd, proc
        on error resume next
        set createwindow = nothing
        signature = left(createobject("Scriptlet.TypeLib").guid, 38)
        set proc = createobject("WScript.Shell").exec("mshta about:""""")
        do
            if proc.status > 0 then exit function
            for each shellwnd in createobject("Shell.Application").windows
                set createwindow = shellwnd.getproperty(signature)
                if err.number = 0 then exit function
                err.clear
            next
        loop
    end function
    

提交回复
热议问题