Skip to content

Commit

Permalink
Merge pull request #855 from vorth/auto-image-capture
Browse files Browse the repository at this point in the history
Added ability to automate image capture
  • Loading branch information
vorth authored Apr 15, 2024
2 parents 4dbc565 + 86a40bf commit 2878806
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion desktop/src/main/java/org/vorthmann/zome/ui/DocumentFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,25 @@ protected void done()
migrated = false;
}

if ( ! asTemplate && migrated ) { // a migration
String imgFormat = mController .getProperty( "imageFormat" );
if ( imgFormat != null ) {

String fileName = mController .getProperty( "window.file" );
File mainFile = new File( fileName );
Path filePath = mainFile .toPath();
fileName = filePath .getFileName() .toString();
int index = fileName .lastIndexOf( "." );
if ( index > 0 )
{
fileName = fileName .substring( 0, index );
}
fileName = fileName + "." + imgFormat;

File imgFile = new File( mainFile .getParentFile(), fileName );
mController .doFileAction( "capture."+imgFormat, imgFile );
mController .actionPerformed( null, "quit" );
}
else if ( ! asTemplate && migrated ) { // a migration
final String NL = System .getProperty( "line.separator" );
if ( mController .propertyIsTrue( "autoFormatConversion" ) )
{
Expand Down

0 comments on commit 2878806

Please sign in to comment.