Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2014
    Posts
    8

    Default Input variables from Text file

    I'd like to be able to set up a script that would read input from a text file. The objective would be to hand off the text file to an operator who would then run a BC script that would read in the variables from the text file.

    Example:

    %1, %2, %3 would be in a snapshot_io.txt file, as below:
    LogFile~C:\Snaplogs\snapshotlogs.txt
    Source~S:\Dir\we\want\to\snapshot
    Output~d:\BCSnaps\MondaySnapshot

    Snapshot script
    #Get Variables from snapshot_io.txt
    ????
    #Log output
    log verbose append:"%1"
    #
    #Capture directory contents to snapshot file
    snapshot save-crc save-version no-filters expand-archives path:"%2" output:"%3"

    Is this doable given the scripting capabilities of BC?

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,899

    Default

    BC Scripting would not support a .txt file with multiple inputs. You would need an alternate script (Batch file, VBScript, etc) to pull this information out and call a BC command line with the %1, %2 variables. BC Scripting does support variables when passed on the command line:

    bcompare.exe "@c:\bcscript.txt" "variabletextA" "variabletextB" "variabletextC"

    which can then be referenced in the bc script with %1, %2, %3, etc
    Aaron P Scooter Software

  3. #3
    Join Date
    Nov 2014
    Posts
    8

    Default Example?

    Can you provide an example of how this would look in a batch file?

    Quote Originally Posted by Aaron View Post
    BC Scripting would not support a .txt file with multiple inputs. You would need an alternate script (Batch file, VBScript, etc) to pull this information out and call a BC command line with the %1, %2 variables. BC Scripting does support variables when passed on the command line:

    bcompare.exe "@c:\bcscript.txt" "variabletextA" "variabletextB" "variabletextC"

    which can then be referenced in the bc script with %1, %2, %3, etc

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,899

    Default

    I'm not familiar with the input pattern or how to parse it, but once you had the text in bat variables, it would call the program with:
    set var1=c:\folder1
    "c:\program files (x86)\beyond comapre 4\bcompare.exe" "@c:\bcscript.txt" "%var1%" "%var2%" "%var3%"

    where var1,2, and 3 have the text values of the parameter, such as a file path: c:\folder1\

    The path is then passed into Beyond Compare, which can then be referenced in the script. Quotes are important to help capture whitespace as part of a path.
    Aaron P Scooter Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •