Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Open MicroStation from PowerShell as background task. Is it possible?
    • Sign In

    • State Verified Answer
    • Replies 6 replies
    • Subscribers 65 subscribers
    • Views 2560 views
    • Users 0 members are here
    • powershell
    • MicroStation
    • ProjectWise

    Open MicroStation from PowerShell as background task. Is it possible?

    Christian Jührendt
    Offline Christian Jührendt over 5 years ago

    Hello,

    i'm using the following script to check out and in documents from ProjectWise. The aim of this task is to open MicroStation, run a VBA block at startup to check the file for some parameters and then closing MicroStation. So is it possible to start the MicroStation from PowerShell without the application window showing (run in background, silent or whatever it is called regarding MicroStation). This is a part of the script i currently use:

    # Get the documents by a stored search for the user as_projectwise.
    $searchResult = Get-PWDocumentsBySearch -SearchName $savedSearch -Personal -GetAttributes
    
    if ($searchResult.length -le 0)
    {
        Write-Host "Sorry, no documents to process found."
    }
    else
    {
        # Check them out to start the validation in MicroStation.
        Write-Host "Checkin out $($searchResult.length) document(s) ..."
        $checkOutResult = CheckOut-PWDocuments -InputDocument $searchResult
    
        # Run microstation in batch mode to validate every document.
        #TODO
        for ($i=0; $i -lt $checkOutResult.length; $i++)
        {
            # Store the result of the validation
            # TODO
            Write-Host "Processing document $($checkOutResult[$i].CheckedOutLocalFileName)."
    
            # Run the microstation and wait until the program is closed.
            $args = "-M $($checkOutResult[$i].CheckedOutLocalFileName) -R"
            $process = Start-Process $pathToMicroStationExe -ArgumentList $args -Wait -WindowStyle Hidden
            # -> MicroStation opens up with full GUI.
    
            # Check in the document
            Write-Host "Checkin in document $($checkOutResult[$i].FileName)."
            $checkInResult = CheckIn-PWDocumentsOrFree -InputDocument $checkOutResult[$i]
        }
    }

    Thanks!

    • Sign in to reply
    • Cancel

    Top Replies

    • Christian Jührendt
      Offline Christian Jührendt Mon, Aug 20 2018 4:09 AM in reply to Kevin van Haaren +1 verified
      Thanks for thinking about this problem. Bentley suggested to create a initapp MDL application but also said that this not supported anymore. https://communities.bentley.com/products/programming/microstation_programming…
    • Brian Flaherty
      0 Offline Brian Flaherty Thu, Jul 12 2018 3:28 PM

      Is there a command line switch for MicroStation to run in non-graphics mode? I am not seeing one available.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Christian Jührendt
      0 Offline Christian Jührendt Fri, Jul 13 2018 5:22 AM in reply to Brian Flaherty

      For this sould be the parameter -WindowStyle Hidden from the PowerShell.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Brian Flaherty
      0 Offline Brian Flaherty Fri, Jul 13 2018 7:42 AM in reply to Christian Jührendt

      From the testing I've done, it doesn't appear the you can use the -WindowStyle Hidden with all applications.  MicroStation is one of those application in which it doesn't appear to work.  Hopefully, someone out there has an alternative for you.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Fri, Jul 13 2018 11:13 AM in reply to Brian Flaherty

      this is possible with a command line switch, however it's hidden. I used to know it but I've forgotten.

      IPlot on a local workstation, ICS server and full-text indexing all launch microstation as a background task via a command line switch but this is probably way unsupported.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Fri, Jul 13 2018 11:46 AM in reply to Kevin van Haaren

      meh, full-text indexing using a wrapper application to hide it, it's not on the commandline. haven't checked the other 2.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    >

    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