OS: Windows 10
I have this python script that asks the user if he/she would like to print a file. While running this python script manually it works fine. However, when installing the Python script as an NSSM service, it skips over the message box part. The following is not the complete program, but a section of it. The rest of the python script (not included bellow) performs as it should win it is running as a service.
#!/usr/bin/python3
import os ,sys
import time
import ctypes
def SomeProgram():
if SomeCondition:
return True, FilePath
def Mbox(title, text, style):
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
if __name__ == '__main__':
while True:
WriteToPdf, FilePath = SomeProgram()
if WriteToPdf:
MboxResult = Mbox('Print?', 'Would you like to print the the file?', 4)
if MboxResult==6:
#Yes was selected. Thus print the document
os.startfile(FilePath, "print")
time.sleep(4)
How do I get a message box wit a script installed as a NSSM service?
EDIT:
NSSM has the following ERROR output to the log file
Traceback (most recent call last):
File "C:\temp\FATs\populate_template.py", line 181, in <module>
MboxResult = Mbox('Print protocoll?', 'Would you like to print the recently saved protocoll', 4)
File "C:\temp\FATs\populate_template.py", line 168, in Mbox
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
KeyboardInterrupt
.CSV
files and converts it to a.PDF
. Once the file is converted, the popup dialog ask the user if they want to print the.PDF
. Thanks for the documentation. I will have to evaluate what would be the best option.