hexagon logo

Create folder script

It used to be here.
Parents
  • Ah. Forget the important basics. I apologize the item I posted was not a full script. Just a section to demonstrate that you could do it.

    Sub Main()
    Dim objFSO, objShell
    Dim PCDApp, PCDPartProgram, PCDCommands, PCDCommand, retval
    Dim objFile, objFolder As Object
    
    'Assign PCDMIS Commands, And pulls In the variables
    Set PCDApp               = CreateObject("PCDLRN.Application")
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDCommands    = PCDPartProgram.Commands
    


    ^ Needs to be at the top of your script.

      strDirectory  = PCDPartProgram.Path & "\" & "Job Log" 
    strFileName = joname.StringValue 
    [B]strPath[/B]         = strDirectory & "/" & strFileName & ".txt"
    


    ^ This is what I use for the my script If you want to build off it. StrPath is the directory you wish to make your folder in. In my example I used multiple variables from my program. You will have to chop it up to make it work.

    TO_FILE=ON,APPEND="[B]Z:\Everyone\ChadJ\2014programs\\"+J1.INPUT+"\JOB# "+J1.INPUT+" TIME "+TIME.PDF[/B]
    


    ^If this is your directory, you could use an assignment in its place and pull the directory in.

    If objFSO.FileExists(strPath) Then
      Set objFile   = objFSO.OpenTextFile(strPath)
    Else
      Set objFile   = objFSO.CreateTextFile(strPath)
        Set objFile = objFSO.OpenTextFile(strPath)
    End If
    
    


    ^Like I said this is an example using a text file creation. You will have to construct one to make a folder.

    It's more than just copy and paste, you will have to tweak it to fit your purposes.
Reply
  • Ah. Forget the important basics. I apologize the item I posted was not a full script. Just a section to demonstrate that you could do it.

    Sub Main()
    Dim objFSO, objShell
    Dim PCDApp, PCDPartProgram, PCDCommands, PCDCommand, retval
    Dim objFile, objFolder As Object
    
    'Assign PCDMIS Commands, And pulls In the variables
    Set PCDApp               = CreateObject("PCDLRN.Application")
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDCommands    = PCDPartProgram.Commands
    


    ^ Needs to be at the top of your script.

      strDirectory  = PCDPartProgram.Path & "\" & "Job Log" 
    strFileName = joname.StringValue 
    [B]strPath[/B]         = strDirectory & "/" & strFileName & ".txt"
    


    ^ This is what I use for the my script If you want to build off it. StrPath is the directory you wish to make your folder in. In my example I used multiple variables from my program. You will have to chop it up to make it work.

    TO_FILE=ON,APPEND="[B]Z:\Everyone\ChadJ\2014programs\\"+J1.INPUT+"\JOB# "+J1.INPUT+" TIME "+TIME.PDF[/B]
    


    ^If this is your directory, you could use an assignment in its place and pull the directory in.

    If objFSO.FileExists(strPath) Then
      Set objFile   = objFSO.OpenTextFile(strPath)
    Else
      Set objFile   = objFSO.CreateTextFile(strPath)
        Set objFile = objFSO.OpenTextFile(strPath)
    End If
    
    


    ^Like I said this is an example using a text file creation. You will have to construct one to make a folder.

    It's more than just copy and paste, you will have to tweak it to fit your purposes.
Children
No Data