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

RE: [trading] [amibroker] Starting AB with different data bases



PureBytes Links

Trading Reference Links

Thanks fred, this is nice!
 
Greg, did you get this running? I am getting errors, cleaned up the wraps but still there appear to be some hidden characters..
 
if you fixed the wraps, could you please post a zipped attachment?
 
many thanks,
herman
-----Original Message-----
From: Greg [mailto:gphanson2@xxxxxxxxx]
Sent: Thursday, December 09, 2004 10:46 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [trading] [amibroker] Starting AB with different data bases


Good Day Fred - thanks for all your work. i've a great deal to learn
here. again many thanks.

Greg
--- In amibroker@xxxxxxxxxxxxxxx, "Fred" <ftonetti@xxxx> wrote:
>
> Careful ... There are line wraps.
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Fred" <ftonetti@xxxx> wrote:
> >
> > This should get you there and then some ...
> >
> > Put the code in a file in your AmiBroker directory.  It needs to
> > have a filetype of .vbs
> >
> > This will check to make sure AB is not running ... start AB
> assuming
> > it's not already running and load the default data base ... If
you
> > need a different one loaded then change the constant name.
> >
> > Option Explicit
> >
> > Dim oWinMgm
> > Dim oProcess
> > Dim oAB
> > Dim oWSH
> > Dim oFSO
> >
> > Dim iAbIsOpen
> > Dim iResult
> > Dim iError
> > Dim sScriptName
> >
> > Const cstDataBaseDir = "C:\Program Files\AmiBroker\Data\"
> >
> > sScriptName = "Start AmiBroker"
> >
> > Set oWSH  = WScript.CreateObject("WScript.Shell")
> > iAbIsOpen = false
> >
> > Err.Clear
> >
> > Set oWinMgm = GetObject("WinMgmts://localhost")
> >
> > If Err <> 0 Then
> >     WScript.Echo Err.Description
> >     iError = True
> > End if
> >
> > iResult = oWSH.popup("Checking To See If Amibroker Is
Running...",
> > 3, sScriptName, 64)
> >
> > For Each oProcess in oWinMgm.ExecQuery ("select * from
> Win32_Process
> > where name='Broker.exe'")
> >     iAbIsOpen = true
> > Next
> >
> > If Err <> 0 Then
> >     WScript.Echo Err.Description
> >     iError = True
> > End if
> >
> > If Not iAbIsOpen Then
> >     iResult = oWSH.popup("Running Amibroker Now...", 3,
> sScriptName,
> > 64)
> >     iResult = oWSH.Run ("Broker.exe", 3, false)
> >     WScript.Sleep(1000)
> > Else
> >     iResult = oWSH.popup("Amibroker Already Running", 3,
> > sScriptName, 64)
> > End If
> >
> > If Err <> 0 Then
> >     WScript.Echo Err.Description
> >     iError = True
> > End if
> >
> > set oWinMgm = Nothing
> >
> > If iError then
> >     Quit
> > End If
> >
> > Set oFSO = CreateObject("Scripting.FileSystemObject")
> > Set oAB  = CreateObject("Broker.Application")
> >
> > iResult = oWSH.popup("Loading Database ...", 3, sScriptName, 64)
> > If Not oAB.LoadDatabase(cstr(cstDataBaseDir)) Then
> >     MsgBox "Cant Load Database"
> >     iError =true
> > End





Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html





Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Yahoo! Groups Sponsor

Get unlimited calls to

U.S./Canada



Yahoo! Groups Links