Exit the script from the pause mode after closing the external Photoshop application

good day...

How to set an external event (CLOSE PHOTOSHOP) to exit script from PAUSE mode?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jahman's picture

.

'exit script from pause' sounds more like start some other script.

1. Get System.Diagnostics.Process instance of photoshop process
2. Make a callback that will be executed on Exited event
3. Subscribe this callback to this event using dotNet.addEventHandler

(
	calcs = (dotNetClass "system.diagnostics.process").getprocessesbyname "calc"
 
	if calcs.Count == 0 do
	(
		format "No running calcs found...\n" 
		format "Lets start one...\n" 
		ShellLaunch "calc" ""
		calcs = (dotNetClass "system.diagnostics.process").getprocessesbyname "calc"
	)
 
	fn StartThisAfterCalcClosed =
	(
		format "Finished...\n" 
	)
 
	fn OnCalculatorProcessClosed sender ev =
	(
		format "Calc just closed...\n" 
 
		StartThisAfterCalcClosed()
	)
 
	calcs[1].EnableRaisingEvents = true
	dotNet.addEventHandler calcs[1] "Exited" OnCalculatorProcessClosed
	dotNet.setLifetimeControl calcs[1] #dotNet
 
	format "Waiting for calc to close...\n" 
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.