HTA file - display status running vbscript

Hello,
My script is very simply code. Display status in HTA form while running vbscript, but this script show status after script running, why?

<html>
<head>
<title>Deloitte User Profile Migration</title>
<link href="css\Wizard.css" type="text/css" rel="stylesheet">
<HTA:APPLICATION ID="oProfileMigration"
      APPLICATIONNAME="Profile Migration"
      ICON="css\Wizard.ico"
          SCROLL="no"
          SELECTION="no"
          INNERBORDER="no"
          BORDER="normal"
          SINGLEINSTANCE="no"
          SYSMENU="yes"
          MAXIMIZEBUTTON="no"
          MINIMIZEBUTTON="yes"
      SHOWINTASKBAR="yes"
    />
<script language="vbscript" type="text/vbscript">
Sub Window_onload
on error resume Next
      CenterWindow 640,480
End Sub      
Sub CenterWindow( widthX, heightY )
    self.ResizeTo widthX, heightY
    self.MoveTo (screen.Width - widthX)/2, (screen.Height - heightY)/2
End Sub

'Button Start
Sub ButtonNextClick
      If buttonnext.Disabled then
            exit sub
      End if
      Call StartSearch
End sub

'Button Cancel
Sub ButtonCancelClick
      If msgbox ("Are you sure you want to cancel?",4,"Cancel Backup?") = vbYes then
            window.Close
      End if
End Sub

'KeyStart
Sub KeyHandler
              if window.event.KeyCode = 27 then
      ButtonCancelClick
                             elseif window.event.KeyCode = 13 then
                                          window.event.returnValue = FALSE
                                                     ButtonNextClick
             end if
End Sub

'Execute code
Sub StartSearch
      ButtonNext.disabled = true
                     'Show Status After running script
      StatusArea.InnerHTML="Searching Office Data Files in c:\ <br>"

Dim oFSO
Dim strUserName
Dim oShell
Dim oEnv

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Wscript.Shell")
Set oEnv = oShell.Environment("SYSTEM")
strUserName = oShell.ExpandEnvironmentStrings("%username%")

SearchPST (oFSO.GetFolder("F:\"))
end sub
'*************************************************
Sub SearchPST(objCurrentFolder)

   Dim strTemp
   Dim strOutput
   Dim objNewFolder
   Dim objFile
 On Error Resume Next
    For Each objFile In objCurrentFolder.Files
         strTemp = Right(objFile.Name, 4)
               If UCase(strTemp) = ".PST" Then
                  wscript.echo CStr(objFile.Path)
                  'oFSO.CopyFile CStr(objFile.Path), "D:\Dados\" & StrUsername & ".$$$" & "\OldPST\" & Date & " " & CStr(objFile.Name)
            End If
      Next
      
      'For Each objNewFolder In objCurrentFolder.subFolders
      '      SearchPST (objNewFolder)
      'Next
      
      For Each objNewFolder In objCurrentFolder.subFolders
  If objNewFolder <> "F:\Documents and Settings\rgaspar\Local Settings\Application Data\Microsoft\Outlook" Then SearchPST (objNewFolder)
 Next
On Error Goto 0
      End Sub
</Script>
</Head>
<body Language="VBScript" onkeydown="KeyHandler">
        <table cellpadding="0" cellspacing="0" border="0" width="100%" style="height: 100%;">
            <tr valign="top">
                <td colspan="2" >
                    <div id="MyContentArea" class="ContentArea" >
                        <H1>Deloitte User Migration</H1>
                        <span style="width: 95%;">
                            <table cellpadding="0" cellspacing="0" border="0">
                                <tr>
                                            Status:<br><br>
                                    <td colspan="2" id="StatusArea"></td>
                                </tr>

                                <tr>
                                            <td colspan="2" id="CountArea"></td>
                                </tr>

                            </table>
                        </span>
                    </div>
                </td>
                       
            </tr>
            <td class="CommandArea" id="RightWizardButtons" align="right">  
                <button accesskey=N type=submit id=buttonNext onclick=ButtonNextClick ><U>S</U>art</button>
                <button accesskey=C id=buttonCancel onclick=ButtonCancelClick><U>C</U>ancel</button>
        </table>
    </body>
</html>

Thanks
ricgasparAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
I would code


'Button Start
Sub ButtonNextClick
      If buttonnext.Disabled then
            exit sub
      End if
      StatusArea.InnerHTML="Searching Office Data Files in c:\ <br>"
      Call StartSearch
End sub

and remove it from the search sub routine to give the browser time to execute the statement


Michel PlungjanIT ExpertCommented:
Did my code work as advertised?
If so, why the "B", if not why no comments?

Thanks
ricgasparAuthor Commented:
Hello, please copy and paste my code and run.
Your code and my code show StatusArea.InnerHTML="Searching Office Data Files in c:\ <br>"
after and finished sub searchpst.
I like a before and running script sub searchpst show status.area.

Thanks
Michel PlungjanIT ExpertCommented:
So why accept my comment

In JavaScript you need to take status messages out of functions that run loops. I expected the same in VB

I was obviously wrong, so a comment to that effect or deleting the question would have been better

thanks

 
ricgasparAuthor Commented:
Hello mplungian,

I accept you comment because your code is right.
So i found this script, see attachment. This script blink status while running vbscript, and stop blink and write status another line when script finish.

Thanks
status-blink-while-running-vbscr.txt

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.