Hat jemand eine Idee, wie ich in einem Journal (.net) zur Laufzeit den Pfad zur Quelldatei herausbekomme?
Den Pfad des kompilierten Journals (journal.dll) kann ich über das Assembly abfragen. Aber fällt jemandem ein, wie ich an die Quelldatei komme, die in NX gestartet wird.
erstellt am: 19. Feb. 2009 11:32 <-- editieren / zitieren --> Unities abgeben: Nur für Jan Boettcher
Zitat:Original erstellt von ThomasZwatz: Laut Doku (dotNET Guide NX5) sollte das gehen mit:
Namespaces > NXOpen > Session > ExecutingJournal .... Returns the full path to the journal that is currently being executed
Thomas
Bei mir funktioniert das bei Ausführung mit Journal Files (*.vb,*.cs), aber bei DLLs (siehe Eingangs-Posting) bekomme ich keinen String zurück. Bei DLLs funktioniert aber die StackTrace-Methode.
Hier der Testcode zum kompilieren:
Code: Option Strict Off Imports System Imports System.Diagnostics Imports NXOpen
Module Module1
' Explicit Activation ' This entry point is used to activate the application explicitly Sub Main()
Dim theSession As Session = Session.GetSession() Dim theUI As UI = UI.GetUI()
' TODO: Add your application code here Dim lw As ListingWindow = theSession.ListingWindow lw.Open() lw.WriteLine("Executing Journal: " & theSession.ExecutingJournal)
Dim st As New StackTrace(New StackFrame(True)) lw.WriteLine("File: " & st.GetFrame(0).GetFileName())
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function
End Module
[Diese Nachricht wurde von Overcast am 19. Feb. 2009 editiert.]
[Diese Nachricht wurde von Overcast am 19. Feb. 2009 editiert.]