Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > OLE
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 10796 of 11982
Post > Topic >>

OLE

by orasnita@[EMAIL PROTECTED] (Octavian Rasnita) Mar 26, 2008 at 12:43 PM

Hi,

Can anyone give me some hints about how I could translate a simple JScript

function into a perl one?
The script is below, but what I don't know how to do are the following 
lines:

 AmiBroker = new ActiveXObject( "Broker.Application" );

 fso = new ActiveXObject( "Scripting.FileSystemObject" );

    stock = AmiBroker.Stocks.Add( fields[ 0 ] );

    WScript.Echo( "Im****ting " + fields[ 0 ] );

    date = new Date( fields[ 2 ] );

    quote = stock.Quotations.Add( date.getVarDate() );

    quote.High  = parseFloat( fields[ 3 ] );


 AmiBroker.RefreshAll();

Of course, some hints about how can I start doing this, will help me.

Thank you.

Here is the whole script:

function Im****tMsASCII( filename )
{
 var fso, f, r;
 var ForReading = 1;
 var AmiBroker;
 var date;
 var quote;
 var fields;
 var stock;

 /* Create AmiBroker app object */
 AmiBroker = new ActiveXObject( "Broker.Application" );

 /* ... and file system object */
 fso = new ActiveXObject( "Scripting.FileSystemObject" );

 /* open ASCII file */
 f = fso.OpenTextFile( filename, ForReading);

 /* skip first line which contains format definition */
 f.SkipLine();

 /* read the file line by line */
 while ( !f.AtEndOfStream )
 {
    r =  f.ReadLine();

    /* split the lines using comma as a separator */
    fields = r.split(",");

    /* add a ticker - this is safe operation, in case that */
    /* ticker already exists, AmiBroker returns existing one */
    stock = AmiBroker.Stocks.Add( fields[ 0 ] );

    /* notify the user */
    WScript.Echo( "Im****ting " + fields[ 0 ] );

    /* parse the date from the text file */
    date = new Date( fields[ 2 ] );

    /* add a new quotation */
    quote = stock.Quotations.Add( date.getVarDate() );

    /* put data into it */
    quote.High  = parseFloat( fields[ 3 ] );
    quote.Low   = parseFloat( fields[ 4 ] );
    quote.Close = quote.Open = parseFloat( fields[ 5 ] );
    quote.Volume = parseInt( fields[ 6 ] );

 }

 /* refresh ticker list and windows */
 AmiBroker.RefreshAll();

 /* notify the user */
 WScript.Echo( "Finished" );

}

Octavian
 




 1 Posts in Topic:
OLE
orasnita@[EMAIL PROTECTED  2008-03-26 12:43:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 1:41:41 CDT 2008.