hexagon logo

To Open/Execute Several Programs Sequentially Using Basic Script

All the while I've been using CallSubs to do that from within the main program, but i've met several bugs and errors from the subroutines i've executed. Can anybody show me a simple basic script to open, execute, save, close several programs simultaneously?
Parents
  • Found this in my repository...

    This code has not been extensively tested and I cannot be held responsible to any damages done by running the code. You run this on your own risk.

    For starters, create a program that simply does nothing more than displays an operator comment with some text, just to see how/that it works. If you choose to include this in an production environment - then that is totally up to you. As always, tweak the code to your own liking.

    It's more like a proof of concept than a complete solution - the customized solution is left for you to create.

    Dim PCDApp, PCDPartPrograms, PCDPartProgram
    
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set PCDPartPrograms = PCDApp.PartPrograms
    
      PCDApp.Visible = True
      PCDPartPrograms.Open "[COLOR="red"]Z:\test1.PRG[/COLOR]", "[COLOR="red"]CMM1[/COLOR]"
    
    Set PCDPartProgram = PCDApp.ActivePartProgram
      
      'msgbox "This will start the execution of the partprogram!"
      PCDPartProgram.Execute
    
      ' PC-DMIS executes the partprogram
    
      PCDPartProgram.Close
    
      ' PC-DMIS closes and saves the partprogram
    
    PCDPartPrograms.Open "[COLOR="red"]Z:\test2.PRG[/COLOR]", "[COLOR="red"]CMM1[/COLOR]"
    
    Set PCDPartProgram = PCDApp.ActivePartProgram
      
      'msgbox "This will start the execution of the partprogram!"
      PCDPartProgram.Execute
    
      ' PC-DMIS executes the partprogram
    
      PCDPartProgram.Close
    
      ' PC-DMIS closes and saves the partprogram
    
    ' Cleanup
    Set PCDPartProgram = nothing
    Set PCDPartPrograms = nothing
    Set PCDApp = nothing


    Save this as 'starter.vbs'. Then edit the path to the partprogram to reflect the partprogram you wish to run. Change the CMM1 to whatever machine interface you want to use and save it.

    Make sure PC-DMIS is running and then doubleclick the starter.vbs to start, execute and save/close the partprogram.


    This should (in theory) open "test1.prg", execute it, close and save and then open "test2.prg", execute it, close and save.
  • I would like to know how can I mark and unmark the program through a script?
Reply Children
No Data