Please refer blow script to send custom message notifications to logged in users.
# -*- coding: utf-8 -*-
import Tkinter
import tkMessageBox
window = Tkinter.Tk()
window.wm_withdraw()
tkMessageBox.showinfo(title="Notification", message="Бесплатная служба заканчивается сегодня. Пожалуйста, подпишитесь, чтобы продолжить услуги")
Note:
1.Script must be executed as logged in user
2.Script will wait for logged in user until he/she click ‘OK’ and then send success status to ITSM.
3.It support non English characters
4. Please set title and message variable string as per your wish.
not working with newest version of C1
File “”, line 4, in
File “C:\Program Files (x86)\COMODO\Comodo ITSM\lib\lib-tk\Tkinter.py”, line 1814, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can’t find a usable init.tcl in the following directories:
{C:/Program Files (x86)/COMODO/Comodo ITSM/lib/tcl8.5} {C:/Program Files (x86)/COMODO/lib/tcl8.5} {C:/Program Files (x86)/lib/tcl8.5} {C:/Program Files (x86)/COMODO/library} {C:/Program Files (x86)/library} {C:/Program Files (x86)/tcl8.5.19/library} C:/tcl8.5.19/library
C:/Program Files (x86)/COMODO/Comodo ITSM/lib/tcl8.5/init.tcl: version conflict for package “Tcl”: have 8.5.19, need exactly 8.5.15
version conflict for package “Tcl”: have 8.5.19, need exactly 8.5.15
while executing
“package require -exact Tcl 8.5.15”
(file “C:/Program Files (x86)/COMODO/Comodo ITSM/lib/tcl8.5/init.tcl” line 19)
invoked from within
“source {C:/Program Files (x86)/COMODO/Comodo ITSM/lib/tcl8.5/init.tcl}”
(“uplevel” body line 1)
invoked from within
“uplevel #0
[list source $tclfile]”
This probably means that Tcl wasn’t installed properly.
We have reported this to our developers and we will inform you the status as soon as possible.
In the meantime, we recommend you to use the script to send custom pop-up message to the endpoint user (who is currently logged in)
Please follow the below instruction for the script,
Run the script as Logged in User
The script execution will complete only when the endpoint user responds to the custom message, so the execution log will only be displayed after the endpoint user responds to the message box.
You can modify the title of the message box on the variable - title=“your title”
You can modify the message of the message box on the variable - message=“your message”
message="Hi, Please leave your computer from 1PM to 2PM, We need to do some maintenance activities." ## Does not support multi line message.
title="Message from: Administrator"
def ecmd(CMD, OUT=False):
import ctypes
class disable_file_system_redirection:
_disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
_revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
def __enter__(self):
self.old_value = ctypes.c_long()
self.success = self._disable(ctypes.byref(self.old_value))
def __exit__(self, type, value, traceback):
if self.success:
self._revert(self.old_value)
from subprocess import PIPE, Popen
with disable_file_system_redirection():
OBJ = Popen(CMD, shell = True, stdout = PIPE, stderr = PIPE)
out, err = OBJ.communicate()
ret=OBJ.returncode
return ret
def wfile(fp, c):
import os
with open(fp, 'w') as f:
f.write(c)
if os.path.isfile(fp):
return fp
return
import os
c1=r'''MsgBox "%s", 4096, "%s"'''%(message, title)
pm=os.path.join(os.environ['TEMP'], 'messagealert.vbs')
filem=wfile(pm, c1)
if ecmd('cscript "%s"'%filem)==0:
print 'The following message is sent the user.
%s'%message
else:
print 'Error on sending message to the user'
os.remove(filem)