How to temporary display a message in a SD Job

Document ID : KB000045564
Last Modified Date : 14/02/2018
Show Technical Document Details

Introduction :

SD Job are executed under Local System Account environment and messages are displayed in the session 0.
"Interactive Services Detection" popup window appears in order to give possibility to view the session 0.
 
In properties of sdagent there is a property "enabledisplayondesktop" which could be use to display the windows and messages directly on desktop windows of logged user.
The default value of this parameter is 0 indicating that all displays are sent to session 0. ("Interactive Services Detection" popup window appears).
 
This command could be use to see the current value of this parameter :
 
C:\>caf getprop sdagent enabledisplayondesktop
Property sdagent/enabledisplayondesktop is currently "0"
 
 
Following Technical Document explains how to change this property to 1 : TEC558019
But with this solution display is sent to desktop of logged user for all SD Jobs.
 
How display a message or window to desktop of logged user for only one specific SD Package ?

 

 

 

 

 

Instructions : 

 
 
1- Here is an example of DM Script which open a readme.txt file on screen using notepad. Create a dms file with this code :
 
 
DIM sCommand, sTempDir, sTempFile AS STRING
DIM rc, fOut AS INTEGER
 
sTempDir=EnvGetstring("TEMP")
sTempFile=sTempDir+"\second_run.tmp"
CcnfGetParameterInt("itrm/common/caf/plugins/sdagent/enabledisplayondesktop",rc)
 
' ----- If enabledisplayondesktop=0 for sdagent plugin      -----
' ----- set it at 1 temporary and signal SD job for a rerun -----
IF (rc=0) THEN
   CcnfSetParameterInt("itrm/common/caf/plugins/sdagent/enabledisplayondesktop",1)
sCommand="CMD /C sd_acmd.exe signal rerun"
   Execute(sCommand,True,0)
   
   ' ----- Create the file %TEMP%\second_run.tmp -----
   chdir(sTempDir)
   fOut=CreateFile(sTempFile)
   CloseFile(fOut)
goto end 
END IF 
 
' ----- Open the file with notepad and script waits until notepad is closed ---
sCommand="CMD /C ""notepad readme.txt"""
Execute(sCommand,True,0)
 
' ----- Open the file with notepad and script continues -----
sCommand="notepad readme.txt"
Execute(sCommand,True,1)
 
' ----- If the job has been executed 2 times  -----
' ----- set enabledisplayondesktop=0          -----
IF ExistFile(sTempFile) THEN
   DeleteFile(sTempFile)
   CcnfSetParameterInt("itrm/common/caf/plugins/sdagent/enabledisplayondesktop",0)
END IF
:end
 
 
 
 
2- Then create a file readme.txt with message which should be displayed to user.
 
3- Create a SD Package with these 2 files and put the dms script as install procedure.
 
Untitled.jpg
 
4- In this example, notepad with readme.txt will appear 2 times.
First time it appears and execution of script stops until notepad is closed.
 
Second time it appears and execution of script continues.

 

Untitled2.jpg

 

5- At the end of script parameter enabledisplayondesktop is set again to 0 (if it was set to 0 before execution of the package).