For some applications Resuscitator is not capable to hide or force
fixed window size and/or position on screen, because of specific
window handling in application.
How to overcome these restrictions in Scorpion application check Master & Slaves example below.
Master & Slaves example
Business case: in production mode main application
(master) always stays maximized and on top of other windows and
supporting programs (slaves) run in hidden mode.
One of possible ways to achieve this in Scorpion - to use built-in python scripting and Win32 API:
- Master profile controls slave profiles via TCP/IP communication.
- Master uses scheduler for periodical window maximization and visibility.
- Master and slave profiles uses Win32 API for maximization and visibility.
For your convenience, this functionality is implemented in scorpionMasterSlave module (Python 2.6 is required).
Available functions in scorpionMasterSlave:
MasterSlave() # Constructor
AddSlave(address) # address is a string with slave profile address
ClearSlaves()
GetMainHWnd() # function returns Scorpion main window handle
Hide()
Show()
Maximize(maximizeWhenSlavesAreHidden) # If parameter is True, this function maximizes main window only if slaves are hidden. Default is False.
ToggleSlavesVisibility()
Default usage of scorpionMasterSlave module
Example profiles Master And Slave Demo - T1_003.zip
NOTE: Module scorpionMasterSlave.py must be placed in profiles Python directory.
In Scorpion Master profile:
# In Central Start create master object and add slaves:
import scorpionMasterSlave
master = scorpionMasterSlave.MasterSlave(isMaster=True)
master.AddSlave("localhost:8701")
master.AddSlave("localhost:8702")
# Create scheduler and attach script:
master.Maximize(maximizeWhenSlavesAreHidden=True)
# Create button and OnClick add script:
master.ToggleSlavesVisibility()
On each Slave profile:
# In Central Start create slave object:
# Variable name must be slave.
import scorpionMasterSlave
slave = scorpionMasterSlave.MasterSlave()
On all profiles TCP/IP communication must be active (Service->Communication->TCP/IP).
|