none
VBScript createTextFile IF RRS feed

  • Question

  • Hi Everyone.

    I have a small issue I need help with.

    I want to create a textfile to merge files in IF I have files.

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Set folder = objFSO.GetFolder("\\aib-pgm\Testing\")

    ' I want to only create below file IF i have files with extension .plc exists in above folder, otherwise it creates an empty file which I do not want.

    Set outFile = objFSO.CreateTextFile("\\aib-pgm\Testing\MergedCasefile_"  & LogExtension & ".plc")

    Thankful for help

    • Moved by Bill_Stewart Monday, April 30, 2018 9:09 PM Unanswerable drive-by question
    Thursday, February 15, 2018 2:19 PM

All replies

  • That code always creates an empty file.  You have to write to the file.

    Since you do not know VBScript you should be using PowerShell VBScript is obsolete and will not work with most newer software packages and cannot manage newer services.


    \_(ツ)_/

    Thursday, February 15, 2018 2:31 PM
  • I dont have a choice, the software im working with only supports vbscript, so you mean there is no way to have an IF around the createtextFile?

    I tried but it gives me access denied.

    Friday, February 16, 2018 7:30 AM
  • "IF" what?  "IF" has to have an expression.  What expression is it that you seek.  A "Set" that creates a file cannot have an IF.  It has no output to test.

    Again: What are you "IF"ing.


    \_(ツ)_/

    Friday, February 16, 2018 8:37 AM
  • I managed to solve it, thank you

    Friday, February 16, 2018 9:39 AM
  • Please post your solution so we can understand your question.


    \_(ツ)_/

    Friday, February 16, 2018 10:35 AM