01-29-2014 11:31 AM
Hello,
For my project, I have to convert the raw values of a signal to physical values.
To do this, I'm using the "Calculate" function.
Because I have a lot of data, it takes time and the user doesn't know if it works or not.
The first thing I did, is to add Dialog.BeginWaitCursor and Dialog.EndWaitCursor that works well but is not sufficient.
To display activity, I would like to display a progress bar created before calling "Calculate" and stopped after that.
The progress bar doesn't need to display the real progress but only display a progress moving even if it starts again from zeor until the end of the calculation.
I read some information about progress on this forum but it was done on selfmade function and not calling DIAdem functions.
That's why it is not usefull for me.
I don't know how to do that using vbs.
Is it possible to create something like that ?
The best solution would be to get the progress of the "Calculate" function to know where it is but the function is not created to do this.
Thanks for any ideas,
Best Regards,
CFOE
Solved! Go to Solution.
01-31-2014 05:13 AM
Hello cfoe:
Use an ActiveX control, this works pretty well and is easy to program it.
Here i send you a small function to set the value of the the bar between 0 - 100
' ProgressBarObject : object in the SUD dialog, ' nVal : value of the progress Sub ProgBar ( ProgressBarObject , nVal) Dim objc Set objc = ProgressBarObject.X objc.Enabled = True objc.Max = 100 objc.Min = 0 objc.Scrolling =1 objc.Appearance =1 objc.BorderStyle=1 objc.OLEDropMode=1 Dim j : j = nVal objc.Value = j Pause (0.01) objc.Refresh Pause (0.01) Next
Regards.
01-31-2014 12:47 PM
Hi Guys,
Be forewarned, though, the trouble with using external COM objects or ActiveX controls is when you go to distribute your application to other computers. Not all the target computers will necessarily have the required COM object or ActiveX control installed, and even if they do it could be the wrong version. You usually end up needing an installer to automaticall install AND register the required external components, and that's extra work. Sometime you do get lucky, though, and all the target computers really are the same in this regard 🙂
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-03-2014 03:24 AM
Hi guys,
Thanks for the responses, in fact to sum up, we can say that there is no simple way to do this without adding or installing extra components.
CFOE
02-03-2014 10:05 AM
Hey CFOE,
I asked R&D in parallel, because I thought I remembered seeing a continuous progress bar in DIAdem before, but I wasn't sure if that was something we could call with a VBScript command. I just heard back that you can, and here it is...
Call AutoLoopInit MsgBox "Ready to Stop the Progress Bar?" Call LoopDeInit
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-04-2014 06:36 AM
Thank you Brad,
I use this function know and it helps me.
I didn't saw that because it was no so quite obvious.
Best Regards,
CFOE
11-07-2014 07:02 AM
Hello.
I wanted to kindly ask you if there is any possibility to change the Activex Progress Bar Color.
Thank You for your help
Best Regards
11-11-2014 04:11 PM
Hi marispaulies,
What do you mean by an "Activex Progress Bar"? DIAdem doesn't install one that I know of, so I'm guessing you've picked an ActiveX control that is registered with your operating system.
You can typically set the ActiveX property "Foo" of an ActiveX control named "MyControl" in a SUDialog by the following syntax:
MyControl.X.Foo = NewValue
Brad Turpin
DIAdem Product Support Engineer
National Instruments
12-02-2014 10:00 AM
Hi Brad,
Using the example from the DIAdem help:
Dim intLoop Call LoopInit() For intLoop= 1 To 100 Call LoopInc(intLoop) Call Pause(0.1) Next Call LoopDeInit()
I did get a status bar to display in one of my scripts, but in another it popped up for a second and then disappeared. What could cause that?
The difference between the scripts is that one is looping through loaded data and the other (with the disappearing status bar) is looping through files which get loaded and removed on the fly. It also calls Portal.Refresh a lot - but commenting that out made no difference. Just curious - a working status bar would be a really helpful visual cue for this particular long-running script.
12-08-2014 01:48 PM
Hi marispaulies,
The progress bar that those commands control is the same one that various functions in DIAdem uses, so if you start to display it programmatically, then run an ANALYSIS routine, for instance, the ANALYSIS routine will commandeer the progress bar. For that reason I often use a non-modal dialog with the MsgBoxDisp() command instead to inform the user of various steps in an ongoing script.
Set Dlg = New NonModalDlg NumSecs = 9 FOR i = 0 TO NumSecs Dlg.Update "Non-modal MsgBox display: Second " & i & " of " & NumSecs ' Call MsgOut("Non-modal MsgBox display: Second " & i & " of " & NumSecs) Call Pause(1) NEXT ' i Call MsgBoxCancel Sub OncePerSec() Dim n, nMax, Msg, LastTime FOR n = 1 TO nMax IF Timer - LastTime > 1 OR Timer < LastTime THEN LastTime = Timer Msg = "Exporting Channel " & n & " of " & nMax & " ..." Call MsgBoxDisp(Msg, "MB_NOBUTTON", "MsgTypeNote", 0, 0, 1) END IF NEXT ' n End Sub ' OncePerSec()
Brad Turpin
DIAdem Product Support Engineer
National Instruments