Opening Pictures From Background Schedules

If a schedule running as a background task opens a picture while you are editing another picture or schedule in configure mode, you may experience unexpected behavior. In some instances, the picture may open over a modal dialog box and you will not be able to return to the original dialog box.

To avoid this problem, it is recommended that when adding an entry to a background schedule that references a picture, you write a custom script that configures the schedule to check whether the object is in the run mode or configure mode before opening a picture.

NOTE: It is recommended that schedules configured to run in the background do not reference pictures. If you do not check whether the WorkSpace is in run mode before opening the picture, and the WorkSpace is in configure mode when the open attempt occurs, the attempt fails since FixBackgroundServer cannot open pictures in configure mode.

The following VBA code shows an example on how a timer object checks whether the Workspace is in run mode before opening a picture named MyPicture.grf. If the WorkSpace is in configure mode, the picture does not open and a program called Task.exe runs instead. The timer object in this example runs from a background schedule:

Private Sub FixTimer3_OnTimeOut(ByVal lTimerId As Long)

Dim WrkSpcApp As Object

Set WrkSpcApp = GetObject("", "Workspace.Application")

 

'If the object is in run mode open the picture

   If WrkSpcApp.Mode = 4 Then

     OpenPicture "MyPicture"

 

'Otherwise, just run this program called Task.exe

   Else

     Task.exe

   End If

 

Set WrkSpcApp = Nothing

End Sub

For more information on creating new schedules and using the Scheduler Properties dialog box, refer to the Creating and Editing Schedules and Entries section.