5 Replies Latest reply: Jul 21, 2016 1:47 AM by Marcus Sommer RSS

    Declaring Variables in VBScript

    Jamel Oueslati

      Hi all,

       

      This is driving me crazy...... I wish to set a variable in VBScript but it's not working.

       

      This is my code....

       

      I am creating a number of folders and I wish to set each folder path as a variable:

       

      ' set ocr path

      SUB Ocr (objVariable)

        ON ERROR RESUME NEXT

        SET objShell = CREATEOBJECT("Shell.Application")

        SET objFolder = objShell.BrowseForFolder (WINDOW_HANDLE, TITLE, OPTIONS, ROOT)

        SET objFolderItem = objFolder.Self

        ocrFolder = objFolderItem.Path

        SET objSavePath = ActiveDocument.Variables(objVariable)

        objSavePath.SetContent ocrFolder, TRUE

        ON ERROR GOTO 0

       

      'create folders

      Dim oFSO

      Set oFSO = CreateObject("Scripting.FileSystemObject")

      ' Create OCR folder

      oFSO.CreateFolder ocrFolder & "\OCR"

      oFSO.CreateFolder ocrFolder & "\OCR\Output"

      oFSO.CreateFolder ocrFolder & "\OCR\Output\Single_File"

      oFSO.CreateFolder ocrFolder & "\OCR\Staging"

      oFSO.CreateFolder ocrFolder & "\OCR\Archive"

       

      dim outputFolder

      outputFolder = ocrFolder & "\OCR\Output\Single_File"

      dim stagingFolder

      stagingFolder = ocrFolder & "\OCR\Staging"

      dim archiveFolder

      archiveFolder = ocrFolder & "\OCR\Archive"

       

      end sub



      ocrFolder is defined (e.g. c:mydocs\myfolder)



      My issue is that outputFolder , stagingFolder & archiveFolder  are not being created?


      What am I doing wrong?