Now, Metastorm has a KnowledgeBase article showing how you can use VBScript to deploy a procedure but it doesn't cover all of our use cases. Specifically, when deploying a procedure that references a library, Metastorm has a nasty habit of popping up a dialog box requiring you to click a button.
Did I also mention their example uses VBScript?
Well, your intrepid blogger decided to see if he could come up with a better\different solution.
Here's a PowerShell script that should work for you:
#This PowerShellscript is to be run to publish a Metastorm procedure
#in unattended mode.
Param(
[String] $dsn = "dsn",
[String] $userId = "userid",
[String] $password = "password",
[String] $procedure = "C:\procedure.xep",
[Int] $secondsToWait = 20
)
#When publishing Metastorm procedures sometimes a dialog box pops up
#giving a status message and requiring user interaction. This script
#checks to see if the dialog box exists and closes it so that
#publishing can finish.
$closeMetastormDialogBox =
{
Param( [Int] $secondsToWait )
Add-Type -AssemblyName Microsoft.VisualBasic
Add-Type -AssemblyName System.Windows.Forms
Start-Sleep -s $secondsToWait
#Is the Metastorm Designer running?
$processExists = Get-Process | Where {$_.mainWindowTitle -eq "Metastorm Designer"} -ErrorAction SilentlyContinue
If( $processExists -ne $null )
{
#Bring the Metastorm dialog box titled "Library Loading Status"
#into focus
[Microsoft.VisualBasic.Interaction]::AppActivate("Library Loading Status")
#Send the close command to the "Library Loading Status" dialog
[System.Windows.Forms.SendKeys]::SendWait("%{F4}")
}
}
#Start the Metastorm designer
$eDesigner = New-Object -ComObject "eDesigner.eDesigner6"
#Publish the Metastorm procedure
$eDesigner.ConnectToEworkDB( $dsn, $userId, $password )
#When opening a procedure sometimes you'll get a pop up dialog
#requiring user interaction. So, start a background task that
#looks for the dialog and closes it.
Start-Job -ScriptBlock $closeMetastormDialogBox -ArgumentList $secondsToWait
$eDesigner.OpenProcedure( $procedure )
Remove-Job -State Completed
$eDesigner.PublishProcedure( "", $false )
$eDesigner.CloseProcedure()
$eDesigner.DisconnectFromEworkDB()
#Close the Metastorm designer
[System.Runtime.Interopservices.Marshal]::ReleaseComObject( $eDesigner )