NX Journal Get environmental information

2019/11/28 categories:NX Journal| tags:NX Journal|VB|

When creating commands in NX Journal, I sometimes want to get the user name, current directory, etc., so I created a program to display them.

VB Code

Option Strict Off
Imports System
Imports NXOpen
Module module1
    Sub Main()
        Dim s As Session = Session.GetSession()
        s.ListingWindow.Open()
        
        s.ListingWindow.WriteLine("User Name: " & Environment.UserName)
        s.ListingWindow.WriteLine("Current Directory: " & Environment.CurrentDirectory)
        s.ListingWindow.WriteLine("System Directory: " & Environment.SystemDirectory)
        s.ListingWindow.WriteLine("My temporary directory is: " & Environment.GetEnvironmentVariable("TEMP"))
        s.ListingWindow.WriteLine("Get Folder Path: " & Environment.GetFolderPath(Environment.SpecialFolder.System))
        s.ListingWindow.WriteLine("Version: " & Environment.Version.ToString)
    End Sub
    
End Module

Share post

Related Posts

コメント