Help in a Journal with Process.Start command
Help in a Journal with Process.Start command
(OP)
Hi
In this journal I get a blank output:
Dim outfile As String = _
"C:\haviv\_00_vita_vme_std\_m3u_assy_002" & "\ugiiOutput.txt"
? can someone help to explain this.
Thank you in advanced
In this journal I get a blank output:
Dim outfile As String = _
"C:\haviv\_00_vita_vme_std\_m3u_assy_002" & "\ugiiOutput.txt"
? can someone help to explain this.
CODE -->
'Start an invisible process.
'You can start a process and get its output without a visible window.
'This shows how to changes to the System folder,
'run the DOS Dir "*.exe" command and send the output to the Output.txt file.
'The Windows XP command shell interpreter recognizes "&&" as a command separator,
'thus, you can put multiple commands on a single line.
' "&&" command separator,
' ">>" redirects output into a file, append to existing
' ">" redirects output into a file, clear the existing.
' Chr(34) = "
Option Strict Off
Imports System
Imports System.Diagnostics
Imports System.Security
Imports System.Windows.Forms
Module NXJournal
Sub Main (ByVal args() As String)
Dim myProcess As Process = New Process()
Dim s As String
Dim outfile As String = _
"C:\haviv\_00_vita_vme_std\_m3u_assy_002" & "\ugiiOutput.txt"
'
' Get the System path.
'
'Dim sysFolder As String =
'System.Environment.GetFolderPath(Environment.SpecialFolder.System)
'
Dim ugiiFolder As String = "C:\Program Files\Siemens\NX 8.5\UGII"
MsgBox(" Changed to folder = " & ugiiFolder)
'
' Createe the command line.
'
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.Arguments = "/C cd " & ugiiFolder & _
" && ug_clone -pim=Yes -o=clone:Import -Part=C:\_m3u_002\comp1.prt" & _
" > " & Chr(34) & outfile & Chr(34) & " && exit"
'
' Start the process in a hidden window.
'
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal 'Hidden
myProcess.StartInfo.CreateNoWindow = False 'True
myProcess.Start()
'
' Kill the process if it doesn't finish in one minute.
'
myProcess.WaitForExit()
'myProcess.WaitForExit(1000)
'If Not myProcess.HasExited Then
'myProcess.Kill()
'End If
'
' Show the results.
'
MessageBox.Show("The 'ug_clone ' command window was " & _
"closed at: " & myProcess.ExitTime & "." & System.Environment.NewLine & _
"Exit Code: " & myProcess.ExitCode)
myProcess.Close()
End Sub
End Module Thank you in advanced





RE: Help in a Journal with Process.Start command
www.nxjournaling.com
RE: Help in a Journal with Process.Start command
My intention is to write a journal that run in native mode.
and manipulate an Assembly as the following:
Save original components parts names in part attribute.
change parts names to comply nxmanager mode, shorten long names
Replace spaces and like so.
and then run ug_clone.exe to import the assembly to nxmanager.
Thank you again.
RE: Help in a Journal with Process.Start command
I ran your code on a test file and got an error of "need to have TCROOT/IMANROOT defined..." (yes we have TC installed). The "ugmanager_clone.bat" will set those environment variables before handing control over to ug_clone. Alternatively, you can set these variables yourself, before calling ug_clone.
www.nxjournaling.com
RE: Help in a Journal with Process.Start command
meanwhile I opened a command prompte window changed directory
To ugii and run this
ug_clone -help > out.txt and this indeed
created a blank out.txt file. ? ?
I'll try it with ugmanager_clone.bat
Thank you again.