I agree with Tonni on this oneāthe behavior is quite annoying.
I have OpenLP and several other programs set to autostart on our church PC. Often, I need to open a PowerPoint presentation just to make some quick changes. Sometimes, I'm faster than the Windows autostart process, and OpenLP ends up closing the presentation again. This is especially frustrating when time is limited.
The changes required to fix this issue would be simple.
Since win32com.client.Dispatch either starts a new instance or connects to an existing one, you would only need to check if the connected instance is a new one. This can be done using process.Presentations.Count, as the count won't be zero if a presentation has already been opened manually.
Here is my suggestion for the check_available() method of powerpointcontroller.py. It should help fix the issue:
def check_available(self):
"""
PowerPoint is able to run on this machine.
"""
log.debug('check_available')
if is_win():
# Entry postfixes are for versions 16=2016-2021, 15=2013, 14=2010, 12=2007, 17=future?
for entry in ['', '.16', '.17', '.15', '.14', '.12']:
try:
process = Dispatch('PowerPoint.Application' + entry)
self.com_obj_name = 'PowerPoint.Application' + entry
if process.Presentations.Count == 0:
process.Quit()
return True
except (AttributeError, pywintypes.com_error):
pass
return False