[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] How to detecting second AmiBroker Instance



PureBytes Links

Trading Reference Links

Herman,
 
You can use the WMI object to detect and operate on instances of AB. Here's an example using _vbscript_:
 

Set oWMI = GetObject("WinMgmts://localhost")
For Each oProcess In oWMI.ExecQuery ("select * from Win32_Process where Name='Broker.EXE'")
    oProcess.Terminate
Next
In stead of the terminate method you can just count the instances and then act on that.
 
d

On Mon, Oct 6, 2008 at 10:18 AM, Herman <psytek@xxxxxxxx> wrote:

I am developing a system that involves simple OLE/J-Scripts. It happens that due to coding bugs I end up with a second instance of AmiBroker. When this happens I can only detect this  using the windows task manager. Several times now i have wasted hours trying to find out why my code didn't export proper reports only to find out that a second AB was running. When I closed everything down everything works fine.


Would anyone know how to detect from (preferable) AFL, or J-Script, whether AB is already running?


TIA,

herman


 


__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___