Skip to main content

Display only in script

  • September 28, 2017
  • 3 replies
  • 0 views

I'm trying to display a string while a script is running with no associated user input.  Any place would be fine.

Specifically, I'd like to show progress while a long script is running, like "347 of 4398 processed".  Every display function I've found then requires the user to click a button to continue.  Thanks.


#Rumba

3 replies

André Escudero

I'm trying to display a string while a script is running with no associated user input.  Any place would be fine.

Specifically, I'd like to show progress while a long script is running, like "347 of 4398 processed".  Every display function I've found then requires the user to click a button to continue.  Thanks.


#Rumba

Hi DanReese,

a possible way to Display a Progress status could be IE
Below Code snippet demonstrate a simple Progressbar.


 

\\code snippet\\

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public PComplete As Integer
Public myProgressBar As Object
Public myCurrentStep As Integer
Public myTitle As String
Public myText As String

Sub Main
percentComplete = 0
call SetTitle("READ RUMBA")
call SetText("")
call Show

Do While percentComplete <= 100
Sleep 500
call Update(percentComplete)
percentComplete = percentComplete 10
Loop

Sleep 3000

call Closeit
wscript.quit
End Sub


Public Function Initialize()
PComplete = 0
myCurrentStep = 0
myTitle = "Progress"
myText = ""
End Function

Public Function SetTitle(pTitle)
myTitle = pTitle
End Function

Public Function SetText(pText)
myText = pText
End Function

Public Function Update(percentComplete)
PComplete = percentComplete
call UpdateProgressBar
End Function

Public Function Show()
Set myProgressBar = CreateObject("InternetExplorer.Application")
myProgressBar.navigate2 "about:blank"
myProgressBar.width = 400
myProgressBar.height = 120
myProgressBar.toolbar = false
myProgressBar.menubar = false
myProgressBar.statusbar = false
myProgressBar.visible = True
myProgressBar.document.write "<body Scroll=no style='margin:0px;padding:0px;'><div style='text-align:center;'><span name='pc' id='pc'>0</span></div>"
myProgressBar.document.write "<div id='statusbar' name='statusbar' style='border:1px solid green;line-height:10px;height:10px;color:green;'></div>"
myProgressBar.document.write "<div style='text-align:center'><span id='text' name='text'></span></div>"
End Function

Public Function CloseIt()
myProgressBar.quit
End Function

Private Function UpdateProgressBar()

If PComplete = 0 Then
m_StatusBarText = ""
End If

For n = myCurrentStep to PComplete - 1
m_StatusBarText = m_StatusBarText & "|"
myProgressBar.Document.GetElementById("statusbar").InnerHtml = m_StatusBarText
myProgressBar.Document.title = n & "% Complete : " & myTitle
myProgressBar.Document.GetElementById("pc").InnerHtml = n & "% Complete : " & myTitle
Sleep 10
Next

myProgressBar.Document.GetElementById("statusbar").InnerHtml = m_StatusBarText
myProgressBar.Document.title = PComplete & "% Complete : " & myTitle
myProgressBar.Document.GetElementById("pc").InnerHtml = PComplete & "% Complete : " & myTitle
myProgressBar.Document.GetElementById("text").InnerHtml = myText
myCurrentStep = PComplete

End Function

 

 


I'm trying to display a string while a script is running with no associated user input.  Any place would be fine.

Specifically, I'd like to show progress while a long script is running, like "347 of 4398 processed".  Every display function I've found then requires the user to click a button to continue.  Thanks.


#Rumba
Thanks! I'll give it a try.

I'm trying to display a string while a script is running with no associated user input.  Any place would be fine.

Specifically, I'd like to show progress while a long script is running, like "347 of 4398 processed".  Every display function I've found then requires the user to click a button to continue.  Thanks.


#Rumba
Thanks! I'll give it a try.