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

[amibroker] Re: Automating Amibroker



PureBytes Links

Trading Reference Links

Hi,

Looks like a script I wrote.

Here is the latest script that works perfectly fine for me.  
Follwoing are the steps I follow ===>
 1. I invoke AmiBroker
 2. I go to command prompt (shell)
 3. I invoke the JScript by typing-in the fullname of the file.


My script is ===>

//////////////////////////////////////////////////////////////////
WScript.Echo( "invoking broker");
var Amibroker = new ActiveXObject("Broker.Application");

WScript.Echo( "checking database path");
if (Amibroker.DatabasePath != "C:\\AMI\\AMIFAST")
{
    try 
    {
        WScript.Echo( "loading database");
        Amibroker.LoadDatabase("C:\\AMI\\AMIFAST");
    }
    catch ( e )
    {
        WScript.Echo( "error loading" + e );
    }


    WScript.Echo( "saving database");
    try 
    {
        Amibroker.SaveDatabase(); 
    }
    catch ( e )
    {
        WScript.Echo( "error saving" + e );
    }
}

WScript.Echo( "importing");
try {
    Amibroker.Import
(0,"C:\\AMI\\AMISYSTEMS\\IMPORT.CSV", "C:\\AMI\\AMISYSTEMS\\IMPORT.FOR
MAT");
}
catch ( e )
{
    WScript.Echo( "error importing" );
}

WScript.Echo( "refreshing");
try
{
    Amibroker.RefreshAll();
}
catch ( e )
{
    WScript.Echo( "error refreshing" + e );
}
//////////////////////////////////////////////////////////////////

Regards,
- Salil V Gangal


--- In amibroker@xxxxxxxxxxxxxxx, "rsmith_den" <rls_jls@xxxx> wrote:
> I copied a wscript source code file from an earlier posting that 
used 
> the automation features of Amibroker, and I tried to execute the 
same 
> wscript file without success. I can automate MS Excel from an 
> external app but I cannot do the same for Amibroker and I think the 
> first line of code is where i fail, "Amibroker = new ActiveXObject
> ("Broker.Application");" . Am I missing a *.dll file somewhere ? In 
> VB I usually have to add a reference to a *.tlb file or a local 
> Active X object. Also is it possible to automate Amibroker from a 
VB 
> app ? The Wscript file I tried to execute is typed as :
> 
> <job id="main">
> 	<script language="JScript">
> 		Amibroker = new ActiveXObject("Broker.Application");
> 
> 		WScript.Echo( "loading database");
> 		try
> 		{ Amibroker.LoadDatabase("C:\\Program 
> Files\\AmiBroker\\DataBid"); }
> 
> 		catch ( e )
> 		{ WScript.Echo( "error loading" + e ); }
> 		
> 		WScript.Echo( "importing");
> 		try
> 		{ Amibroker.Import(0,"C:\Documents and 
> Settings\Smith\My Documents\Ticker 
> Data\AWA\Bid\AWA0811.txt", "C:\\Program 
> Files\\AmiBroker\\Formats\\default.format"); }
> 
> 		catch ( e )
> 		{ WScript.Echo( "error importing" ); }
> 		
> 		WScript.Echo( "refreshing");
> 		Amibroker.RefreshAll();
> 		
> 		WScript.Echo("saving");
> 		Amibroker.SaveDatabase();
> 		
> 		WScript.Echo( "done");
> 
> 	</script>
> 	
> </job>


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/