cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

How do I get automated scripts to save graph pictures as maximized windows, rather than small window size?

I use windows batch files to run scripts on a schedule, which will run regardless of if the computer is locked or not. The scripts gather data and then save images as .pngs to various locations.

 

If I am signed into the computer, I can run the script and the images will be saved as maximized windows - the graphs will fill the screen and you can tell the window size is large. These same scripts when ran by windows automatically will save the pictures in a smaller window size which squishes the graphs quite a bit.

 

Is there anything I can add to these scripts to ensure they are saving with the maximum window size?

 

I have tried using <<Maximize Window in the script, which works only when I run it manually, but not in the automated version. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: How do I get automated scripts to save graph pictures as maximized windows, rather than small window size?

Not sure why that wouldn't work for you. Here's a slightly different approach:

Wait( 10 ); // to lock the screen
dt = Open( "$sample_data/big class.jmp" );
gb = H List Box( // <<<<<<<<<<<<<<<<<<<<<<<
    dt << Graph Builder(
        Show Control Panel( 0 ),
        Size( 1920*2, 1080*2 ), // <<<<<<<<<<<<<<<
        //  Fit to Window( "Off" ), // <<<<<<<<<<<<<<<<<
        Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
        Elements(
            Points( X, Y, Legend( 1 ) ),
            Smoother( X, Y, Legend( 2 ) )
        )
    )
);

gb << savepicture( "$desktop/gb2.png" );

gb2.png attached.

When a platform like graph builder launches, it looks around to see if there is a display box (like the H List Box(...) above) it can attach to. If it finds one, it does not open a new window, so it won't get the fit to window behavior that way either.

Craige

View solution in original post

4 REPLIES 4
Craige_Hales
Super User

Re: How do I get automated scripts to save graph pictures as maximized windows, rather than small window size?

Try this:

 

// for graph builder
gb = Graph Builder(
    Show Control Panel( 0 ),
    Size( 3000, 3000 ), // <<<<<<<<<<<<<<<
    Fit to Window( "Off" ), // <<<<<<<<<<<<<<<<<
    Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
    Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);

gb<<savepicture("$desktop/gb.png");

This works for Graph Builder when the screen is locked and can make huge graphs; you'll need to bump up the font sizes and line widths too if you go as big as shown above. Most other platforms don't have the FitToWindow behavior, so just resizing the graph is sufficient.

I'm not sure how windows implements the locked screen behavior, sometimes referred to as headless. Discussion , I'm not recommending installing any third party software.

 

Craige

Re: How do I get automated scripts to save graph pictures as maximized windows, rather than small window size?

Thank you! I tried this but it didn't seem to work. The sizes of the images being saved do not match what is being declared in the Size() of the graph builder, even with fit to window off. I tried setting the graph to 1920x1080 but they are being saved at something like 1024x700 when screen is locked.

 

Is there any way to save a picture with a forced size, maybe through a report or journal?

Craige_Hales
Super User

Re: How do I get automated scripts to save graph pictures as maximized windows, rather than small window size?

Not sure why that wouldn't work for you. Here's a slightly different approach:

Wait( 10 ); // to lock the screen
dt = Open( "$sample_data/big class.jmp" );
gb = H List Box( // <<<<<<<<<<<<<<<<<<<<<<<
    dt << Graph Builder(
        Show Control Panel( 0 ),
        Size( 1920*2, 1080*2 ), // <<<<<<<<<<<<<<<
        //  Fit to Window( "Off" ), // <<<<<<<<<<<<<<<<<
        Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
        Elements(
            Points( X, Y, Legend( 1 ) ),
            Smoother( X, Y, Legend( 2 ) )
        )
    )
);

gb << savepicture( "$desktop/gb2.png" );

gb2.png attached.

When a platform like graph builder launches, it looks around to see if there is a display box (like the H List Box(...) above) it can attach to. If it finds one, it does not open a new window, so it won't get the fit to window behavior that way either.

Craige

Re: How do I get automated scripts to save graph pictures as maximized windows, rather than small window size?

That worked. Thank you!