I am working on a new project where I create a visual basic form that allows the user to select the .prg file from the network and the script will save the .prg and .cad file to a local folder, if it doesn't already exist, then open that program automatically in PC-Dmis in operator mode so all they have to do is select the marked set and run. I have everything working except having the program open in Operator Mode. Everytime I try, it opens online mode. I read somewhere that there is a text file that you can create that allows you to open PC-Dmis, but it doesn't state how to get a program to open in it. Here is my code. Any help would be greatly appreciated. I will include the full code with file copy, but the PC-DMIS related code at the end is all I really need help with.
Code:
Public Class File_Explorer Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click OpenFileDialog1.InitialDirectory = "C:\Test\Approved" OpenFileDialog1.Title = "Find your Program" OpenFileDialog1.Filter = ".PRG files|*.prg" OpenFileDialog1.Multiselect = False If OpenFileDialog1.ShowDialog() = DialogResult.OK Then Dim sourceDir As String = OpenFileDialog1.FileName 'Sets 'sourceDir' to the location of the selected PRG file Dim sourceFileName As String = Dir(sourceDir) 'Extracts PRG file name from path Dim cadDir As String = IO.Path.ChangeExtension(sourceDir, ".CAD") 'Sets 'cadDir' to the location of the selected CAD file Dim cadFileName As String = Dir(cadDir) 'Extracts CAD file name from path Dim destDir As String = IO.Path.Combine("C:\Test\CMM Programs\", sourceFileName) 'Get PRG Destination Path Dim destCADDir As String = IO.Path.Combine("C:\Test\CMM Programs\", cadFileName) 'Get CAD Destination Path If My.Computer.FileSystem.FileExists(destCADDir) Then 'Do nothing and move on Else 'Copy file IO.File.Copy(cadDir, destCADDir) End If If My.Computer.FileSystem.FileExists(destDir) Then 'Do nothing and move on Else 'Copy file IO.File.Copy(sourceDir, destDir) End If Dim PCDApp, PCDPartPrograms PCDApp = CreateObject("PCDLRN.Application") PCDPartPrograms = PCDApp.PartPrograms PCDApp.Visible = True PCDPartPrograms.Open(destDir, "Offline") End If End Sub
Comment