// Act on all image documentes of the current workspace // Exit, if there is none. number nDoc = CountImageDocuments() if ( 0 == nDoc ) exit( 0 ) string help = "Sorting images:\n" help += "Image of the current workspace are sequentially shown.\n" help += "For each, press either the CTRL or ALT key on the keyboard\n" help += "to sort the images as good (CTRL) or bad (ALT).\n" help += "Press SHIFT to abort." if ( !OKCancelDialog( help ) ) exit( 0 ) // Create 'good' and 'bad' workspace after the current number wsID = WorkspaceGetActive( ) number pos = WorkspaceGetIndex( wsID ) number wsGoodID = WorkspaceAdd( pos + 1 ) number wsBadID = WorkspaceAdd( pos + 2 ) WorkspaceSetName( wsGoodID , "Good" ) WorkspaceSetName( wsBadID , "Bad" ) number t,l,b,r number option = 1 + 2 GetMaximalDocumentWindowRect( option , t , l , b , r ) // Iteratively display all documents and ask the user for a decision for ( number i = 0 ; i < nDoc ; i++ ) { imageDocument doc = GetImageDocument( 0 ) if ( !doc.ImageDocumentIsValid() ) break doc.ImageDocumentShowAtRect( t , l , b , r ) while( 1 ) { if ( ShiftDown() ) exit(0) if ( OptionDown() ) { doc.ImageDocumentMoveToWorkspace( wsBadID ) sleep( 0.1 ) break } if ( ControlDown() ) { doc.ImageDocumentMoveToWorkspace( wsGoodID ) sleep( 0.1 ) break } } } WorkspaceArrange( wsGoodID, 1, 0 ) WorkspaceArrange( wsBadID, 1, 0 ) OKDialog( "Sorting done" )