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?
 
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
0
 
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


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

Thanks
0
 
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
0
 
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

 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.