# Winole prob or not

**URL:** <https://rubytalk.org/t/winole-prob-or-not/43613>\
**Category:** ruby-talk\
**Created:** [8 January 2008 17:44 UTC](https://rubytalk.org/t/winole-prob-or-not/43613 "2008-01-08T17:44:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@Junkone](https://rubytalk.org/u/Junkone)\
**Post date:** [8 January 2008 17:44 UTC](https://rubytalk.org/t/winole-prob-or-not/43613/1 "2008-01-08T17:44:58Z")

</div>

hello  
i am chcking if i have the app amibroker instance running. if it is, i  
want to close it smoothly. however i land into a ole problem here. it  
only quits 1 instance at a single run. for eg. if i i have 3  
instances running and i execute the following script. it will close 1  
instance leaving 2 open. if i run it again, it will close another  
instance leaving 1 open. is it a win32ole prob or amibroker prob.

def closeAB  
&nbsp;&nbsp;&nbsp;&nbsp;application = WIN32OLE.new("Broker.Application")  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;application.quit  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "called to close"  
end

&nbsp;&nbsp;&nbsp;# Everything  
&nbsp;&nbsp;&nbsp;ProcTable.ps.each { |p|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(p.caption =="Broker.exe") then  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# close amibroker  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts " found ab"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closeAB

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
&nbsp;&nbsp;&nbsp;}
