Functions | Variables
fwScreenShot.ctl File Reference

Functions

void fwScreenShot_screenShotUserMenu (dyn_string &exceptionInfo, string sModuleName="", string sPanelName="")
 
void fwScreenShot_exportTableContentUserMenu (string sTableName, dyn_string &exceptionInfo)
 
void _fwScreenShot_takeScreenShotToFile (string sFileName, dyn_string &exceptionInfo, string sModuleName="", string sPanelName="")
 
void _fwScreenShot_takeTableContentToFile (string sTableName, string sFileName, dyn_string &exceptionInfo)
 
void fwScreenShot_sendScreenShotByEmail (dyn_string &exceptionInfo, string sModuleName="", string sPanelName="")
 
void fwScreenShot_sendTableContentByEmail (string sTableName, dyn_string &exceptionInfo)
 
void fwScreenShot_saveScreenShotToFile (dyn_string &exceptionInfo, string sModuleName="", string sPanelName="")
 
void fwScreenShot_saveTableContentToFile (string sTableName, dyn_string &exceptionInfo)
 
string _fwScreenShot_getTemporaryFileName (string sFilePrefix, string sExtension, dyn_string &exceptionInfo)
 
string _fwScreenShot_getUserWritableFolder (dyn_string &exceptionInfo)
 
bool _fwScreenShot_isFileWritable (string sFileName, dyn_string &exceptionInfo)
 
void _fwScreenShot_checkFileExtension (string &sFileName, string sExtension, dyn_string &exceptionInfo)
 

Variables

const string FWSCREENSHOT_EMAILPANEL = "objects/fwGeneral/fwSendEmail.pnl"
 
const string FWSCREENSHOT_CSV_DELIMITER = ";"
 
int gNumEmailSent = 1
 
const string SERROR_MESSAGE_SAVE = "Failed to save screenshot."
 
const string SERROR_MESSAGE_SEND = "Failed to send screenshot."
 

Detailed Description

This library is used to take a screen shot of the current module and panel and either save it or send it by email. It also provides the functions to export the content of a table to file or by email.

The two functions fwScreenShot_exportTableContentUserMenu and fwScreenShot_screenShotUserMenu are selfcontained and be called directly from any panel. It will proposed a dropdown menu allowing the user to choose what action he wants to do, i.e. send by email or save to disk.

Creation Date
23/06/14
Modification History
23/06/14 Jean-Charles Tournier - Initial implementation
Constraints
Author
Jean-Charles Tournier (EN-ICE-SCD)

Function Documentation

void _fwScreenShot_checkFileExtension ( string &  sFileName,
string  sExtension,
dyn_string &  exceptionInfo 
)

Check if a file has a particular extension. If it does not, it adds the extension to the name of the file

Usage
Private
WinCC OA Manager
UI
Parameters
stringsFileName: file name to be checked
stringsExtension: extension to be checked without the .
dyn_stringexceptionInfo: Details of errors/exceptions returns here

Referenced by fwScreenShot_saveScreenShotToFile(), fwScreenShot_saveTableContentToFile(), fwScreenShot_sendScreenShotByEmail(), and fwScreenShot_sendTableContentByEmail().

string _fwScreenShot_getTemporaryFileName ( string  sFilePrefix,
string  sExtension,
dyn_string &  exceptionInfo 
)

Return the name of a file along with its path which can be used to take the screenshot when sending by email

Usage
Private
WinCC OA Manager
UI
Parameters
stringsFilePrefix: prefix for the file name with will be build
stringsExtension: extension used for the file name
dyn_stringexceptionInfo: Details of errors/exceptions returns here
Returns
the name of the file with its path or empty in case of errors/exceptions

References _fwScreenShot_isFileWritable(), and fwException_raise().

Referenced by fwScreenShot_sendScreenShotByEmail(), and fwScreenShot_sendTableContentByEmail().

string _fwScreenShot_getUserWritableFolder ( dyn_string &  exceptionInfo)

Return the name of folder in which the user can save a file. It scans the usual windows folders as well as the linux folder. If no writable folder can be found, an empty string is returned

Usage
Private
WinCC OA Manager
UI
Parameters
dyn_stringexceptionInfo: Details of errors/exceptions returns here
Returns
the name of the folder to which the user has write access

Referenced by fwScreenShot_saveScreenShotToFile(), and fwScreenShot_saveTableContentToFile().

bool _fwScreenShot_isFileWritable ( string  sFileName,
dyn_string &  exceptionInfo 
)

Check if a file can be created/written. Compared to the function access(), this function can handle cases where the file does not exists yet

Usage
Private
WinCC OA Manager
UI
Parameters
stringsFileName: absolute file name to be checked
dyn_stringexceptionInfo: Details of errors/exceptions returns here
Returns
true if the file is writtable, false otherwise

Referenced by _fwScreenShot_getTemporaryFileName(), _fwScreenShot_takeScreenShotToFile(), and _fwScreenShot_takeTableContentToFile().

void _fwScreenShot_takeScreenShotToFile ( string  sFileName,
dyn_string &  exceptionInfo,
string  sModuleName = "",
string  sPanelName = "" 
)

Take a screenshot of a given panel and module and save it to a file

Usage
Private
WinCC OA Manager
UI
Parameters
stringsFileName: name of the file (absolute path) to which the screenshot will be saved
dyn_stringexceptionInfo: Details of errors/exceptions returns here
stringsModuleName: name of the module which will be screenshoted. By default myModuleName is considered
stringsPanelName: name of the panel which will be screenshoted. By default myPanelName is considered

References _fwScreenShot_isFileWritable(), and fwException_raise().

Referenced by fwScreenShot_saveScreenShotToFile(), and fwScreenShot_sendScreenShotByEmail().

void _fwScreenShot_takeTableContentToFile ( string  sTableName,
string  sFileName,
dyn_string &  exceptionInfo 
)

Take a screenshot of a given panel and module and save it to a file

Usage
Private
WinCC OA Manager
UI
Parameters
stringsTableName: name of the table shape which content needs to be exported
stringsFileName: name of the file (absolute path) to which the screenshot will be saved
dyn_stringexceptionInfo: Details of errors/exceptions returns here

References _fwScreenShot_isFileWritable(), and fwException_raise().

Referenced by fwScreenShot_saveTableContentToFile(), and fwScreenShot_sendTableContentByEmail().

void fwScreenShot_exportTableContentUserMenu ( string  sTableName,
dyn_string &  exceptionInfo 
)

Open an popup menu for the user to decide if he wants to save the content of a table to disk or to send it by mail and perform the actions

Usage
Public
WinCC OA Manager
UI
Parameters
stringsTableName: name of the table shape for which the content need to be exported
dyn_stringexceptionInfo: Details of errors/exceptions returns here

References fwException_raise(), fwScreenShot_saveTableContentToFile(), and fwScreenShot_sendTableContentByEmail().

void fwScreenShot_saveScreenShotToFile ( dyn_string &  exceptionInfo,
string  sModuleName = "",
string  sPanelName = "" 
)

Allow the user to save the screenshot of any given module and panel to a specific file. By default the user will be proposed to save the file in its own directory

Usage
Public
WinCC OA Manager
UI
Parameters
dyn_stringexceptionInfo: Details of errors/exceptions returns here
stringsModuleName: name of the module which will be screenshoted. By default myModuleName is considered
stringsPanelName: name of the panel which will be screenshoted. By default myPanelName is considered

References _fwScreenShot_checkFileExtension(), _fwScreenShot_getUserWritableFolder(), _fwScreenShot_takeScreenShotToFile(), and fwException_raise().

Referenced by fwScreenShot_screenShotUserMenu().

void fwScreenShot_saveTableContentToFile ( string  sTableName,
dyn_string &  exceptionInfo 
)

Allow the user to save the content of a table passed as parameter to a csv file. By default the user will be proposed to save the file in its own directory

Usage
Public
WinCC OA Manager
UI
Parameters
stringsTableName: name of the tabel shape to be exported
dyn_stringexceptionInfo: Details of errors/exceptions returns here
stringsModuleName: name of the module which will be screenshoted. By default myModuleName is considered
stringsPanelName: name of the panel which will be screenshoted. By default myPanelName is considered

References _fwScreenShot_checkFileExtension(), _fwScreenShot_getUserWritableFolder(), _fwScreenShot_takeTableContentToFile(), and fwException_raise().

Referenced by fwScreenShot_exportTableContentUserMenu().

void fwScreenShot_screenShotUserMenu ( dyn_string &  exceptionInfo,
string  sModuleName = "",
string  sPanelName = "" 
)

Open an popup menu for the user to decide if he wants to save the screenshot to disk or to send it by mail and perform the actions

Usage
Public
WinCC OA Manager
UI
Parameters
dyn_stringexceptionInfo: Details of errors/exceptions returns here
stringsModuleName: name of the module which will be screenshoted. By default myModuleName is considered
stringsPanelName: name of the panel which will be screenshoted. By default myPanelName is considered

References fwScreenShot_saveScreenShotToFile(), and fwScreenShot_sendScreenShotByEmail().

void fwScreenShot_sendScreenShotByEmail ( dyn_string &  exceptionInfo,
string  sModuleName = "",
string  sPanelName = "" 
)

Take a screenshot of a given panel and module and send it by email To send a screenshot by email, a file containing the screenshot must be created first. The function will first try to find a place where to create this file, but in case of failure it will ask the user to choose a writtable folder where the screenshot can be saved.

Usage
Public
WinCC OA Manager
UI
Parameters
dyn_stringexceptionInfo: Details of errors/exceptions returns here
stringsModuleName: name of the module which will be screenshoted. By default myModuleName is considered
stringsPanelName: name of the panel which will be screenshoted. By default myPanelName is considered

References _fwScreenShot_checkFileExtension(), _fwScreenShot_getTemporaryFileName(), _fwScreenShot_takeScreenShotToFile(), and fwException_raise().

Referenced by fwScreenShot_screenShotUserMenu().

void fwScreenShot_sendTableContentByEmail ( string  sTableName,
dyn_string &  exceptionInfo 
)

Take the content of table and send it by email as an attachement The function will first try to find a place where to create this attachement, but in case of failure it will ask the user to choose a writtable folder where the file can be saved.

Usage
Public
WinCC OA Manager
UI
Parameters
stringsTableName: name of the table shape which content needs to send by email
dyn_stringexceptionInfo: Details of errors/exceptions returns here

References _fwScreenShot_checkFileExtension(), _fwScreenShot_getTemporaryFileName(), _fwScreenShot_takeTableContentToFile(), and fwException_raise().

Referenced by fwScreenShot_exportTableContentUserMenu().