Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Progress or Status Bar (VBScript)

Anyone come up with a good way to display some useful text to the user WHILE the VBScript is processing?  I tried updating out to a text object, but the object is only updated when the script completes.

1 Solution

Accepted Solutions
Not applicable
Author

I was able to figure this out.  I created a text box, and named it "StatusBar."  I then created the below function and called the function whenever I wanted something displayed to the user DURING processing of the VB. 

I found that the "WaitForIdle" command would make sure the text box would refresh such that the user would see the content in the "StatusBar" text box.  I also found that the "WaitForIdle" command is expensive in terms of processing time.  So I also added a parameter in the function "sUpdateScreen" that I could use to tell the function to update the screen or not.  Passing "CLS" to the function clears the text box.

FUNCTION StatusBar(sStatusBar,sUpdateScreen)

  set myObject = ActiveDocument.GetSheetObject("StatusBar")

  set myObjectProp = myObject.GetProperties

  SELECT CASE sStatusBar

  CASE "CLS"

  myobject.SetText ""

  CASE ELSE

  myobject.SetText now & ":  " & sStatusBar & chr(10) & myobject.GetText

  END SELECT

  if sUpdateScreen = True then ActiveDocument.GetApplication.WaitForIdle

END FUNCTION

View solution in original post

4 Replies
Siva_Sankar
Master II
Master II

Carletion,

Find here http://community.qlik.com/thread/32363

Regards.

Siva

Not applicable
Author

Siva,

Thanks for the suggestion, but that isn't what I was looking for.  I was hoping to find some solution similar to the Excel VBA command Application.StatusBar where I can display actual text to the user as the VBScript is progressing.  The solution you propose is only the equivelant to an hour-glass effect. 

Any other ideas?

Not applicable
Author

I was able to figure this out.  I created a text box, and named it "StatusBar."  I then created the below function and called the function whenever I wanted something displayed to the user DURING processing of the VB. 

I found that the "WaitForIdle" command would make sure the text box would refresh such that the user would see the content in the "StatusBar" text box.  I also found that the "WaitForIdle" command is expensive in terms of processing time.  So I also added a parameter in the function "sUpdateScreen" that I could use to tell the function to update the screen or not.  Passing "CLS" to the function clears the text box.

FUNCTION StatusBar(sStatusBar,sUpdateScreen)

  set myObject = ActiveDocument.GetSheetObject("StatusBar")

  set myObjectProp = myObject.GetProperties

  SELECT CASE sStatusBar

  CASE "CLS"

  myobject.SetText ""

  CASE ELSE

  myobject.SetText now & ":  " & sStatusBar & chr(10) & myobject.GetText

  END SELECT

  if sUpdateScreen = True then ActiveDocument.GetApplication.WaitForIdle

END FUNCTION

Not applicable
Author

This sounds to me an interesting question. I don't have much experience in status control, hence I feel so helpless on these kind of question, though I'd ever coped with a C# progressbar control. The solution here is so helpful and insightful to me. I'd like to see more related questions.