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

[amibroker] Re: MIKE - SIMPLE WRITELINE JAVASCRIPT FOR AMIBROKER USE QUESTION


  • Date: Mon, 30 Nov 2009 20:34:02 -0000
  • From: "bistrader" <bistrader@xxxxxxxxx>
  • Subject: [amibroker] Re: MIKE - SIMPLE WRITELINE JAVASCRIPT FOR AMIBROKER USE QUESTION

PureBytes Links

Trading Reference Links

Mike, It looks like using single quotes works.
ts.Write ( line3a + '"' + line3b + '" ' + line3c );

In any case, would appreciate feedback on using function, var, writeline, write and overall approach to creating a text file as I plan to expand on this for some AmiBroker work.  Thanks. 


--- In amibroker@xxxxxxxxxxxxxxx, "bistrader" <bistrader@xxx> wrote:
>
> Mike,
> I am having problems creating a txt file via JavaScript for AmiBroker use so I create the following simple example.  I want the txt file to be exactly the following, but can not get the quotes to be included.
> 
> I pick x of y for today.
> This is my final pick.
> These are "My Winners" for the day.
> 
> Here, x and y are variables and My Winners is in quotes.
> 
> Plus, I want to expand on this so would appreciate feedback on whether my approach to using a function, var, writeline and write, etc is a good way to approach writing what is needed to a file.
> 
> Here is my example code and thanks 
> **************************
> 
> // Attempt to do the following.
> // 1. Set x to 5 and y to 8 for a function
> // 2. Create a file to write to called myoutput.txt
> // 3. Write the following to this file, where x is set to 5, y to 8.
> //      I pick x of y for today.
> //      This is my final pick.
> //      These are "My Winners" for the day.
> 
> // I am having problems writing My Winners in quotes.
> 
> // ----------------------------------------------------------------------------
> // Create AmiBroker object and get Analysis object
> // ----------------------------------------------------------------------------
> var AB, AA;
> 
> AB = new ActiveXObject("Broker.Application");
> AA = AB.Analysis;
> 
> // ----------------------------------------------------------------------------
> // Set x = 5 and y = 8 for function
> // ----------------------------------------------------------------------------
> var x = 5;
> var y = 8;
> 
> WLEmpty_Directory = "C:\\Amibroker\\Temp\\";
> WLEmpty_ExploreFileName = "myoutput.txt";
> WLEmpty_ExploreFile = WLEmpty_Directory + WLEmpty_ExploreFileName; 
> 
> VarAndQuotes.call(x,y);
> 
> AA.ShowWindow(0);
> 
> // ----------------------------------------------------------------------------
> // Function to create an txt where x and y change and with
> // some of the text in quotes
> // ----------------------------------------------------------------------------
> function VarAndQuotes(x1,y1)
> {
>     var fso, f, ts;
>     var x1, y1;
>     var ForReading = 1, ForWriting = 2, ForAppending = 8;
>     var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
> 
>     var line1a = "I pick ";// need to place 'x' after this
>     var line1b = " of ";// need to place 'y' after this.
>     var line1c = " for today.";
>     var line2 = "This is my final pick.";
>     var line3a = "These are ";
>     var line3b = "My Winners";// need to somehow place in double quotes
>     var line3c = "for the day.";// no carrage return after.
> 
>     fso = new ActiveXObject("Scripting.FileSystemObject");
>     fso.CreateTextFile( WLEmpty_ExploreFile );
>     f = fso.GetFile(WLEmpty_ExploreFile);
>     ts = f.OpenAsTextStream(ForWriting, TristateUseDefault);
>     
>     ts.WriteLine ( line1a + x + line1b + y + line1c );
>     ts.WriteLine ( line2 );
>     ts.Write ( line3a + " + line3b + " + line3c );// DOES NOT WORK
>     ts.Close( );
>     AB.RefreshAll();
> }
> 
> 
> 
> // Thanks for the help!
> 
> // Bert
>




------------------------------------

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

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

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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