Print all image documents with an optional frame
DigitalMicrograph Script
This automation script will print all currently shown images in page mode using the default printer setting. The script will optionally add a rectangular border to the page.
Preview
number nImg = CountImageDocuments()
number addBorder = TwoButtonDialog( "Add a page border?", "Yes" , "No" )
number print = TwoButtonDialog( "Print?", "Yes" , "No" )
for ( number i = 0 ; i < nImg ; i ++ )
{
imageDocument doc = GetImageDocument( i )
doc.ImageDocumentEnsurePlacedOnPage( )
doc.ImageDocumentSwitchToPageMode( )
if ( addBorder )
{
number top, left, bottom, right
doc.ImageDocumentGetPageBounds( top, left, bottom, right )
component pageBorder = NewBoxAnnotation( top, left, bottom, right )
pageBorder.ComponentSetFillMode( 2 ) // 2 = not filled
pageBorder.ComponentSetForegroundColor( 0.9, 0.9, 0.9 ) // light grey
doc.ImageDocumentGetRootComponent().ComponentAddChildAtEnd( pageBorder )
}
if ( print )
{
doc.ImageDocumentPrint( NULL , 0 ) // 0 = Do not prompt and use the default printer
}
}