GETTING ERROR WHILE RUNNING MAPKEY IN VB-API
- May 18, 2017
- 1 reply
- 3282 views
Hello Everyone.
I have created a MAPKEY to choose a config file from the Working Directory. Its working fine in manual mode.
Now i have added this mapkey to a Button Function. What actually the button will do is it will launch the CREO first after that it should run the mapkey to select the config file.
Launching CREO is working fine but its not running the macro.
Should i declare anything before i call the function " IpfcBaseSession.RunMacro" when i went through the VB-API document i didnt find any such thing.
Below is my CODE and ERROR Message.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim asyncConnection As IpfcAsyncConnection = Nothing
Dim form As Form2
Try
lblStatus.Text = ""
If TextBox1.Text = "" Then
MsgBox("Please enter Creo Parametric path", MsgBoxStyle.Critical)
lblStatus.Text = "Please enter Creo Parametric path"
Else
lblStatus.Text = "Starting Creo Parametric Session ..."
Me.lblStatus.Refresh()
Me.Cursor = Cursors.WaitCursor
asyncConnection = (New CCpfcAsyncConnection).Start(TextBox1.Text, ".")
If Not (TextBox2.Text = "") Then
asyncConnection.Session.ChangeDirectory(TextBox2.Text)
End If
Me.WindowState = FormWindowState.Minimized
form = New Form2(asyncConnection)
form.ShowDialog()
End If
Catch ex As Exception
MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
If Not asyncConnection Is Nothing AndAlso asyncConnection.IsRunning Then
asyncConnection.End()
End If
lblStatus.Text = "Error occurred while starting new Creo Parametric Session"
Finally
Me.WindowState = FormWindowState.Normal
Me.Cursor = Cursors.Default
Me.Refresh()
End Try
IpfcBaseSession.RunMacro( c @MAPKEY_LABELCONFIG;~ Select `main_dlg_cur` `appl_casc`;\,
Close `main_dlg_cur` `appl_casc`;~ Command `ProCmdRibbonOptionsDlg` ;\,
mapkey(continued) ~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `ConfigLayout`;\,
mapkey(continued) ~ Select `ribbon_options_dialog` `ConfigLayout.ImportExportBtn`;\,
mapkey(continued) ~ Close `ribbon_options_dialog` `ConfigLayout.ImportExportBtn`;\,
mapkey(continued) ~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\,
mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;\,
mapkey(continued) @MANUAL_PAUSESelect Config File..........;\,
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\,
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`;)
End Sub
For error message please see the attached image.
Kindly help me to solve this issue.
With Regards
Aghil.M

