Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Automation and Productivity Gains: A PowerShell Use Case - Accel ProjectWise virtual conference
    • Sign In

    • Replies 7 replies
    • Subscribers 68 subscribers
    • Views 1120 views
    • Users 0 members are here
    • powershell
    • ProjectWise
    • ProjectWise PowerShell Modules

    Automation and Productivity Gains: A PowerShell Use Case - Accel ProjectWise virtual conference

    Marty.Nickel
    Offline Marty.Nickel over 3 years ago

    Please use this thread for all questions relating to the Accel ProjectWise virtual conference's session on Automation and Productivity Gains: A PowerShell Use Case

    • Sign in to reply
    • Cancel
    Parents
    • Kevin van Haaren
      Offline Kevin van Haaren Sat, Apr 25 2020 9:35 PM

      Marty should be posting a PDF of the presentation soon, in the meantime here's some of the sample code I had in the presentation

      # Datasource with PDFs
      $datasource = "Dev Datasource"
      
      # Splat for where to locate PDFs
      $pdf_splat = @{
      	FolderPath = 'Users\KvanHaaren\PDFTest\Sheets'
      	FileName = '%.pdf'
      }
      		
      # Splat to merge PDFs
      $merge_splat = @{
      	InputDocuments = @()
      	OutputFolder = 'Users\KvanHaaren\PDFTest\Book'
      	OutputName = '715 Kirk Floor Plans.pdf'
      	VersionExisting = $true
      }
      				
      New-PWLogin $datasource
      # Get documents
      $pdfs = Get-PWDocumentsBySearch @pdf_splat
      
      # add documents to merge splat
      $merge_splat.InputDocuments = $pdfs
      
      # make book
      $book = Merge-PWPDFs @merge_splat
      
      # did it work?
      $book | Select Name,CreateDate,Version

      This is the basic script for merging PDFs. It incorporates some of my favorite methods such as using splat variables to put all the configuration data at the top where it's easy to find and modify, and the code later on. The $pdf_splat can be adjusted to include any of the Get-PWDocumentsBySearch options. Options that are typically just specified on the command line with no value (like -JustThisFolder) can be put in a splat by setting the key to $true (option turned on) or $false (option off).

      # Splat for where to locate PDFs
      $pdf_splat = @{
      	FolderPath = 'Users\KvanHaaren\PDFTest\Sheets'
      	FileName = '%.pdf'
          JustThisFolder = $false
      }
      

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Cancel
    Reply
    • Kevin van Haaren
      Offline Kevin van Haaren Sat, Apr 25 2020 9:35 PM

      Marty should be posting a PDF of the presentation soon, in the meantime here's some of the sample code I had in the presentation

      # Datasource with PDFs
      $datasource = "Dev Datasource"
      
      # Splat for where to locate PDFs
      $pdf_splat = @{
      	FolderPath = 'Users\KvanHaaren\PDFTest\Sheets'
      	FileName = '%.pdf'
      }
      		
      # Splat to merge PDFs
      $merge_splat = @{
      	InputDocuments = @()
      	OutputFolder = 'Users\KvanHaaren\PDFTest\Book'
      	OutputName = '715 Kirk Floor Plans.pdf'
      	VersionExisting = $true
      }
      				
      New-PWLogin $datasource
      # Get documents
      $pdfs = Get-PWDocumentsBySearch @pdf_splat
      
      # add documents to merge splat
      $merge_splat.InputDocuments = $pdfs
      
      # make book
      $book = Merge-PWPDFs @merge_splat
      
      # did it work?
      $book | Select Name,CreateDate,Version

      This is the basic script for merging PDFs. It incorporates some of my favorite methods such as using splat variables to put all the configuration data at the top where it's easy to find and modify, and the code later on. The $pdf_splat can be adjusted to include any of the Get-PWDocumentsBySearch options. Options that are typically just specified on the command line with no value (like -JustThisFolder) can be put in a splat by setting the key to $true (option turned on) or $false (option off).

      # Splat for where to locate PDFs
      $pdf_splat = @{
      	FolderPath = 'Users\KvanHaaren\PDFTest\Sheets'
      	FileName = '%.pdf'
          JustThisFolder = $false
      }
      

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Cancel
    Children
    No Data

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies