Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 785

Adding two Macros in a journal with YES/NO user selection

$
0
0

Hello,

I am currently trying to create a journal running two macros with Yes/No user command selection . I have two separate macros (Macro1 and Macro2) for creating two types of features in UG.

When I run the journal, a Yes or No bar need to come (similar to below code).

1) When I select YES from message bar, it will open and run Macro1
2) When I select NO from message bar, it will open and run Macro2

Journal code I have for creating Message bar is below

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpenUI
Imports System.Windows.Forms

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim theUISession As UI = UI.GetUI
Dim response As Integer

'+----------------------------------+
'¦ ¦
'¦ first, the NX messagebox ¦
'¦ ¦
'¦ ¦
'¦ +--------+ ¦
'¦ ¦ OK ¦ ¦
'¦ +--------+ ¦
'+----------------------------------+

response = theUISession.NXMessageBox.Show("Question", NXMessageBox.DialogType.Question, "DO YOU WANT TO CREATE THIS FEATURE?")
'1 = Yes
'2 = No

'My requirement: If response=yes then open "C:\Users\myname\Documents\Macro1.macro" need to run
'If response=No then open "C:\Users\myname\Documents\Macro2.macro" need to run

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

End Function

End Module

Thanks


Viewing all articles
Browse latest Browse all 785

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>