Grooper 21.00.0082 is available as of 12-12-2023! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 23.1.0016 is available as of 03-15-2024! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 23.00.0042 is available as of 03-22-2024! Check the Downloads Discussion for the release notes and to get the latest version.

Append Previous Pages

Grooper Version 2.70.0021

We have been using a custom Object in our 2.6 production versions that will append all of the preceding loose pages to the previous document, instead of just one page at a time with the Append previous page command (Ctrl + P).  We do know that you can grab multiple pages by holding down the shift key while selecting the pages, but we have learned that using the custom object command that we have been using (Ctrl+Shift+P) is far more efficient than grabbing multiple pages with the shift command.  For some reason, the script that works on 2.6 is not working on 2.7.  I have been able to compile the script, but for some reason I cannot get the command to work.  It does not even appear as an option as a customizable hot key.  Below is the script that will successfully compile on 2.7.  Please tell me if there is something that I can do to modify this to work.  Thank you.

Imports Grooper.Core

''' <summary>Append all selected [Batch Pages], and any sibling batch pages between the selection and the previous sibling [Batch Folder].</summary>
''' <remarks>All Batch Pages between the previous Batch Folder and the last selected Batch Page will be appended to the end of the previous Batch Folder.</remarks>
<DataContract, DisplayName("Append Previous Pages"), AppliesTo(GetType(BatchViewer)), IconResource("Error_Icon"), Keys(System.Windows.Forms.Keys.Control + System.Windows.Forms.Keys.P), RequiresUI, SkipConfirmation>
Public Class AppendPreviousPages : Inherits ObjectCommand(Of BatchViewer)

  Protected Overrides Sub Execute(Item As BatchViewer)
    Dim bv As BatchViewer = Item
    Dim CurItem As BatchObject = bv.SelectedItems.Last
    Dim Pages As New List(Of BatchPage)

    While (CurItem.IsPage)
      Pages.Insert(0, CurItem)
      CurItem = CurItem.PrevNode
    End While

    Dim NewParent As BatchFolder = CurItem
    For Each bp In Pages
      bp.Move(NewParent)
    Next
    bv.SelectedItems = Pages
  End Sub

  Protected Function Overrrides(Item As BatchViewer) As Boolean
    Dim bv As BatchViewer = Item
    If (Not bv.SelectedItems.Any) Then Return False
    If (bv.SelectedItems.First.IsFolder) Then Return False
    Dim PrevNode As BatchObject = bv.SelectedItems.First.PrevNode
    While (PrevNode IsNot Nothing)
      If (PrevNode.IsFolder) Then Return True
      PrevNode = PrevNode.PrevNode
    End While
    Return False
  End Function

End Class

Best Answer

Answers

Sign In or Register to comment.