hexagon logo

Create folder script

It used to be here.
Parents
  • Ok, I think I'm almost there.

    ASSIGN/OOT=GETPROGRAMINFO("NUMOOT")
                ASSIGN/TIME=GETPROGRAMINFO("TIME")
    J1         =COMMENT/INPUT,YES,FULL SCREEN=NO,
                'Job Number:'
                ASSIGN/JOB=J1.INPUT
                ASSIGN/PATH="Z:\Everyone\ChadJ\2014programs\\"+J1.INPUT+"\JOB# "+J1.INPUT+" TIME "+TIME.PDF
                ASSIGN/PATH2="Z:\Everyone\ChadJ\2014programs\\"+J1.INPUT
                IF/OOT==0
    CS1          =SCRIPT/FILENAME= C:\USERS\CJACQUAY\DESKTOP\MAKEFOLDER3.BAS
                  FUNCTION/Main,SHOW=YES,,
                  STARTSCRIPT/
                  ENDSCRIPT/
                  PRINT/REPORT,EXEC MODE=END,$
                    TO_FILE=ON,APPEND=PATH,AUTO OPEN REPORT=OFF,$
                    TO_PRINTER=OFF,COPIES=1,$
                    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
                    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                    TO_EXCEL_OUTPUT=OFF,
                    PREVIOUS_RUNS=DELETE_INSTANCES
                END_IF/
    


    Sub Main()
    
    Dim objFSO, objShell
    Dim PCDApp, PCDPartProgram, PCDCommands, PCDCommand, retval
    Dim objFile, objFolder As Object
    
    Set PCDApp=CreateObject("PCDLRN.Application")
    Set PCDPartProgram=PCDApp.ActivePartProgram
    Set PCDCommands=PCDPartProgram.Commands
    
    Set Jobnumber=PCDPartProgram.GetVariableValue("JOB")
    Set Pathname=PCDPartProgram.GetVariableValue("PATH2")
    
    strFolderName=Jobnumber.StringValue
    strPath=Pathname.StringValue
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    If objFSO.FileExists(strPath) Then
      'Set objFile=objFSO.OpenFolder(strPath)
    Else
      Set objFile=objFSO.CreateFolder(strPath)
      'Set objFile=objFSO.OpenFolder(strPath)
    End If
    
    End Sub
    


    I commented out the OpenFolder lines because I'm not sure that's what should be there. When I run the program it works perfect if there wasn't already a folder there, but if there is it errors out on line 22. strFolderName is probably not needed.
Reply
  • Ok, I think I'm almost there.

    ASSIGN/OOT=GETPROGRAMINFO("NUMOOT")
                ASSIGN/TIME=GETPROGRAMINFO("TIME")
    J1         =COMMENT/INPUT,YES,FULL SCREEN=NO,
                'Job Number:'
                ASSIGN/JOB=J1.INPUT
                ASSIGN/PATH="Z:\Everyone\ChadJ\2014programs\\"+J1.INPUT+"\JOB# "+J1.INPUT+" TIME "+TIME.PDF
                ASSIGN/PATH2="Z:\Everyone\ChadJ\2014programs\\"+J1.INPUT
                IF/OOT==0
    CS1          =SCRIPT/FILENAME= C:\USERS\CJACQUAY\DESKTOP\MAKEFOLDER3.BAS
                  FUNCTION/Main,SHOW=YES,,
                  STARTSCRIPT/
                  ENDSCRIPT/
                  PRINT/REPORT,EXEC MODE=END,$
                    TO_FILE=ON,APPEND=PATH,AUTO OPEN REPORT=OFF,$
                    TO_PRINTER=OFF,COPIES=1,$
                    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
                    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                    TO_EXCEL_OUTPUT=OFF,
                    PREVIOUS_RUNS=DELETE_INSTANCES
                END_IF/
    


    Sub Main()
    
    Dim objFSO, objShell
    Dim PCDApp, PCDPartProgram, PCDCommands, PCDCommand, retval
    Dim objFile, objFolder As Object
    
    Set PCDApp=CreateObject("PCDLRN.Application")
    Set PCDPartProgram=PCDApp.ActivePartProgram
    Set PCDCommands=PCDPartProgram.Commands
    
    Set Jobnumber=PCDPartProgram.GetVariableValue("JOB")
    Set Pathname=PCDPartProgram.GetVariableValue("PATH2")
    
    strFolderName=Jobnumber.StringValue
    strPath=Pathname.StringValue
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    If objFSO.FileExists(strPath) Then
      'Set objFile=objFSO.OpenFolder(strPath)
    Else
      Set objFile=objFSO.CreateFolder(strPath)
      'Set objFile=objFSO.OpenFolder(strPath)
    End If
    
    End Sub
    


    I commented out the OpenFolder lines because I'm not sure that's what should be there. When I run the program it works perfect if there wasn't already a folder there, but if there is it errors out on line 22. strFolderName is probably not needed.
Children
No Data