Subscribe Bookmark RSS Feed

Scripting a JMP Journal

sophiaw

Community Trekker

Joined:

Jul 10, 2015

Hi,

I've looking everywhere, but I can't seem to find anything about scripting a Journal. I've been able to make a journal by hand, but I want to incorporate a Journal script with my current script. My current script does a lot of data analysis and saves all the graphs as PNG files, which I then drag and drop into the Journal.

I've tried to just append the window that the graph is in to the Journal, but it does not look right. I do not care if it is interactive, I just want to be able to script the same thing that I can do by dragging images into the Journal.

I'm not sure where to start. I want to also include Outline Items and Text Items between my images to denote what graph is what. I've tried to copy the script from the Journal to see how it's doing things, but it's just blank, or has stuff that doesn't make sense.

I would appreciate any help!

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

To attach a picture you can use a Picture Box (in the online help look for PictBox under display boxes (not PictureBox) - not the picture box wants a reference to the file which is obtained with the Open function, and the option function must include the 2nd argument which is the file type e.g. "png" or "jpg".  Here is an example assuming you have a file "Picture1.png":

nw = New Window("Journal With Pic", <<Journal,

    vlb = V List Box(

        ob = Outline Box("Pictures")

    )

);

ob << Append(

    Picture Box( Open("Picture1.png","png"))

);

-Dave
9 REPLIES
vince_faller

Super User

Joined:

Mar 17, 2015

From the Scripting Guide

    Journals

    It is relatively easy to put things into a journal window. It it more difficult to see how to

    manipulate the journal itself. The following examples show some journal manipulations.

    Suppose you start with a report, generated in this case from the Big Class.jmp data table.

    biv=bivariate (y(weight), x(height));

    rbiv=biv << report;

    To journal the report results, use the journal window message.

    rbiv<<journal window;

Unless you have to have a journal for some reason, you could always use a new window() to graph things the same way and just build your display boxes.

Or

If you use the combine selected windows checkbox (Bottom right) on the graphs you want, it can create an application that you can save the script from.

10020_pastedImage_1.png

David_Burnham

Super User

Joined:

Jul 13, 2011

To create a journal you create a new window with the <<Journal message.  From then on you can use standard scripting of display boxes to control content of the journal, for example:

10022_Picture1.png

dt = Open("$SAMPLE_DATA\Big Class.jmp");

// create a journal with an outline to contain the graph

nw = New Window("My Journal", <<Journal,

    ob = Outline Box("My Graphs",

        Text Box("<b>Histograms of weight & height</b>", <<Markup(1))

    )

);

// create a graph

content = V List Box(

    Text Box("This output below was produced using the distribution platform"),

    Distribution(

        Continuous Distribution( Column( :height ) ),

        Continuous Distribution( Column( :weight ) ),

        Histograms Only

    );

);

// add graph to outline box within the journal

ob << Append(content);


-Dave
sophiaw

Community Trekker

Joined:

Jul 10, 2015

 
pmroz

Super User

Joined:

Jun 23, 2011

With your second "journal = " statement, you're setting the journal variable equal to a new outline box, which has nothing to do with the original outline box.  You need to create a journal, and then start appending things to it.  This will work:

// Start a new journal to save all the output graphs

journal = New Window( "Class All Data", <<Journal,

    vb = V List Box(

        ob = Outline Box( "Leakage Data",

            Text Box( "Distribution of all Leakage data", <<Bullet Point( 1 ) ),

        )

    )

);

new_ob = Outline Box( "Rterm Data",

    Text Box( "Distribution of all Rterm data", <<Bullet Point( 1 ) )

);

vb << append( new_ob );

David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

To attach a picture you can use a Picture Box (in the online help look for PictBox under display boxes (not PictureBox) - not the picture box wants a reference to the file which is obtained with the Open function, and the option function must include the 2nd argument which is the file type e.g. "png" or "jpg".  Here is an example assuming you have a file "Picture1.png":

nw = New Window("Journal With Pic", <<Journal,

    vlb = V List Box(

        ob = Outline Box("Pictures")

    )

);

ob << Append(

    Picture Box( Open("Picture1.png","png"))

);

-Dave
vasudha_vasudev

Community Trekker

Joined:

Jan 26, 2016

Hi sophiaw,

Can you share the script you use to save multiple graphs as PNG files? I haven't been able to figure out how to save a graph as a PNG file using JSL.

Thanks for any help!

sophiaw

Community Trekker

Joined:

Jul 10, 2015

 
vasudha_vasudev

Community Trekker

Joined:

Jan 26, 2016

Thank you! That's exactly what I needed.

sophiaw

Community Trekker

Joined:

Jul 10, 2015

Thank you PMroz and David! That was exactly what I was looking for.

Thanks for all the help!