NEW1.06.05 · Released 26 November 2012
NEWfinPOWER Connect
Released in
1.06.05
26 November 2012
  1. Opened1 Nov
  2. Closed7 Nov
  3. Released26 Nov
Article 10655 Job J010644

Scripts can now display progress form and allow the User to cancel them

Script can now display a progress form and give the User the ability to cancel them.

The following code sample shows how to display a progress box with the ability to cancel.

Public Function Main(ByVal parameters As ISKeyValueList) As Boolean

  Const LoopMax As Integer = 1000

  Dim Cancelled As Boolean
  Dim i As Integer

  ' Assume Success
  Main = True

  ' Status Begin
  finBL.StatusProcessBegin("Progress Status Test", "Initialising", True)
  
  ' Sleep
  System.Threading.Thread.Sleep(2000)

  ' Progress
  For i = 0 To LoopMax
    ' Progress
    finBL.StatusProcess((i / LoopMax) * 100, "Item " & CStr(i), Cancelled)

    ' Cancelled?
    If Cancelled Then
      Main = False
      finBL.Error.ErrorBegin("Script was cancelled by the User.")
      Exit For
    End If

    ' Sleep
    System.Threading.Thread.Sleep(10)
  Next

  ' Status End
  finBL.StatusProcessEnd()

End Function

NOTE: Do not allow the Script to be cancelled unless your Script is running from a logical place, e.g., showing this progress or allowing the Script to be cancelled for an 'Object Events' type Script could cause issues.