Hi all, I am writing some scripts to control some lab equipment, and sometimes I observe that the script "misses" one of the steps, leading to cascading errors. For example, at one part of the code I wrote this:
 
	WinClose("Port_Configuration") 
	Sleep(1000) 
	WinClose("Hype") 
	Sleep(1000) 
	Run("C:\Users\cabrunco\Desktop\Hype!Terminal.exe")
 
	Most of the times this works, but I found that in some occasions the windows fail to close. Then, the code becomes a mess, because a second instance of the program will launch, and both windows now have the same title. I think I can solve this problem with this code:
 
	While WinExists("Hype") 
	    WinClose("Port_Configuration") 
	    Sleep(1000) 
	    WinClose("Hype") 
	    Sleep(1000) 
	WEnd 
	Run("C:\Users\matheus\Desktop\Hype!Terminal.exe")
 
	I would like to know if anybody has any other suggestions for this kind of redundant code. Thanks,
 
	Matheus