Applies To:
  • CitectSCADA 5.xx, 6.xx
  • CitectHMI 5.xx, 6.xx

The SendKeys() function works fine for sending keystrokes to other applications during testing, but it fails on an unattended server.

This will happen if Citect is running while windows is locked--either by the user or automatically when the screen saver activates.

If the PC is in a secure room and locking the desktop is not required, leaving it unlocked will eliminate the problem. If the PC must be locked, then an alternate method will have to be used. For example, if a document needs to be printed from an external program, it may be possible to use command-line options instead of sending keystrokes to open the document and print it (Q4168):

Exec("notepad.exe /p c:\report.txt", 6); 

If the program accepts DDE commands, the DDEExec() function may be used to execute commands (macros). For example, after creating a spreadsheet, these commands will save the file and close Excel:

DDEExec("excel.exe", "[Close(1)]");
DDEExec("excel.exe", "[Quit]");