system.gui.openDesktop() fails occasionally

My apologies for the late response, I got sidetracked with other things and forgot to follow up on this.

I do a lot of multidesktop scripting, and I've never had any problems, so naturally, I look for things that are being done differently. For example, I only ever specify x and y on really large monitors or when opening multiple desktops in the same screen. Even so, I've never seen the script fail because of a coordinate specification. One thing that I've never done is assign the openDesktop to a variable and setAlwaysOnTop, but this should be doable with a JFrame, so I don't understand why that would be a problem.

One thing we haven't explored is where is this script being called from? Perhaps that could be the issue.

In any case, here is an example of using the screen data to set the desktops instead of directly specifying the coordinates. Try this and see if the problem persists:

openDesktops = len(system.gui.getDesktopHandles())
monitorData = system.gui.getScreens()
if openDesktops == 0 and len(monitorData) > 1:
	for desktopIndex, desktopWidth, desktopHeight in monitorData[1:]:
		handleName = "Desktop %d" %desktopIndex
		system.gui.openDesktop(screen=desktopIndex, handle=handleName, width=desktopWidth, height=desktopHeight).setAlwaysOnTop(True)
		#system.nav.desktop(handleName).swapTo('whatever/window/path')
elif openDesktops > 0:
	print 'Execution halted: Multiple open desktops have been detected'
else:
	print 'Execution halted: Only one monitor detected'