gongi
Computer
- Jul 2, 2015
- 2
[pre]Hi everybody!
I've been looking for the way to execute several NXJournal dll or several Macros in a certain order and I found two examples about it but neither of them work in the proper way.[/pre]
For example:
In the case of NXJournal
I found this example:
'' This example demonstrates launching another VB .NET application's Main entrypoint.
'' The Launching application might look like this:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module NXJournal
Sub Main()
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = s.ListingWindow
lw.Open()
Dim libname As String = "launch_it.dll"
Dim fullpath As String = Nothing
ufs.UF.FindFile("application", libname, fullpath)
If fullpath Is Nothing Then
lw.WriteLine("application\" & libname & " not found")
Else
Dim nada() As Object = {} ' Main doesn't take any arguments
lw.WriteLine("Launcher will now attempt to Execute " & fullpath)
s.Execute(fullpath, "NXJournal", "Main", nada)
End If
End Sub
Function GetUnloadOption(ByVal arg As String) As Integer
Return CType(Session.LibraryUnloadOption.Immediately, Integer)
End Function
End Module
You can find that here :
but since this line: "ufs.UF.FindFile("application", libname, fullpath)" It has an error an the program stops working
the error message that is shown is: "Fatal error detected unable to continue, unhandled operating system exception: e0434352"
then I have the second solution with the macros
I found this:
and it works well when I use just one macro but if I want to execute several macros like this:
so then it just play the last Macro in the array.
So I've been searching for more information about this problem but I haven't found it yet.
If you know something more about it I will be really grateful for your help.
I've been looking for the way to execute several NXJournal dll or several Macros in a certain order and I found two examples about it but neither of them work in the proper way.[/pre]
For example:
In the case of NXJournal
I found this example:
'' This example demonstrates launching another VB .NET application's Main entrypoint.
'' The Launching application might look like this:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module NXJournal
Sub Main()
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = s.ListingWindow
lw.Open()
Dim libname As String = "launch_it.dll"
Dim fullpath As String = Nothing
ufs.UF.FindFile("application", libname, fullpath)
If fullpath Is Nothing Then
lw.WriteLine("application\" & libname & " not found")
Else
Dim nada() As Object = {} ' Main doesn't take any arguments
lw.WriteLine("Launcher will now attempt to Execute " & fullpath)
s.Execute(fullpath, "NXJournal", "Main", nada)
End If
End Sub
Function GetUnloadOption(ByVal arg As String) As Integer
Return CType(Session.LibraryUnloadOption.Immediately, Integer)
End Function
End Module
You can find that here :
but since this line: "ufs.UF.FindFile("application", libname, fullpath)" It has an error an the program stops working
the error message that is shown is: "Fatal error detected unable to continue, unhandled operating system exception: e0434352"
then I have the second solution with the macros
I found this:
Module NXJournal
Declare Sub MACRO_playback_from_usertool Lib "libugui" Alias "?MACRO_playback_from_usertool@@YAXPEBD@Z" (ByVal lpName As String)
Sub Main
MACRO_playback_from_usertool("C:\temp\test.macro")
End Sub
End Module
Declare Sub MACRO_playback_from_usertool Lib "libugui" Alias "?MACRO_playback_from_usertool@@YAXPEBD@Z" (ByVal lpName As String)
Sub Main
MACRO_playback_from_usertool("C:\temp\test.macro")
End Sub
End Module
and it works well when I use just one macro but if I want to execute several macros like this:
Dim macro As New List(Of String)()
macro.Add("D:\Users\212464629\Desktop\run\base")
macro.Add("D:\Users\212464629\Desktop\run\componente1")
macro.Add("D:\Users\212464629\Desktop\run\componente2")
Try
For Each path As String In macro
MACRO_playback_from_usertool(path)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
macro.Add("D:\Users\212464629\Desktop\run\base")
macro.Add("D:\Users\212464629\Desktop\run\componente1")
macro.Add("D:\Users\212464629\Desktop\run\componente2")
Try
For Each path As String In macro
MACRO_playback_from_usertool(path)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
so then it just play the last Macro in the array.
So I've been searching for more information about this problem but I haven't found it yet.
If you know something more about it I will be really grateful for your help.