VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. I have a text file with some info that I would like to put to variables. I can read the whole line..... but I am having trouble reading parts of the text file into a variable.


    below is my input.txt

    \\janedserver\sageuncm\CSINY-TheRideIn-2608863-0.mpg!!!1Pass Xvid@@@CSI: NY###The Ride-In$$$%%%

    Input2.txt
    \\janedserver\sageuncn\Medium-SecondOpinion-2608778-0.mpg!!!1Pass Xvid@@@Medium###Second Opinion$$$%%%


    I would like to read it and input to variables like this

    filename=\\janedserver\sageuncm\CSINY-TheRideIn-2608863-0.mpg
    encodetype=1Pass Xvid
    Series=CSI: NY
    Episode=The Ride-In


    The Script below is what I use to read the line of text
    Const ForReading = 1

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.OpenTextFile _
    ("c:\input.txt", ForReading)

    'Do Until objTextFile.AtEndOfStream
    lineoftext = objTextFile.ReadLine
    Wscript.Echo lineoftext
    'Loop

    objTextFile.Close


    Thanks in advance
    Quote Quote  
  2. Member mats.hogberg's Avatar
    Join Date
    Jul 2002
    Location
    Sweden (PAL)
    Search Comp PM
    First, split it with "!!!" as the delimiter.
    Code:
    dim arr
    arr=split(lineoftext,"!!!")
    filename=arr(0)
    next, split agin with "@@@" as delimiter:
    Code:
    arr=split(arr(1),"@@@")
    encodeype=arr(0)
    Last, split with "###" as delimiter:
    Code:
    arr=split(arr(1),"###")
    Series=arr(0)
    Episode=left(arr(1),len(arr(1))-6) ' to get rid of ending "$$$%%%"
    /Mats
    Quote Quote  
  3. Mats,

    I made a few changes I was getting an error the "Array was locked"/. Its working now thanks for all your help.


    Const ForReading = 1

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.OpenTextFile _
    ("c:\input.txt", ForReading)
    lineoftext = objTextFile.ReadLine
    objTextFile.Close

    dim arr
    arr=split(lineoftext,"!!!")
    filename=arr(0)
    msgbox filename

    dim arr2
    arr2=split(arr(1),"@@@")
    encodetype=arr2(0)
    msgbox encodetype

    dim arr3
    arr3=split(arr2(1),"###")
    Series=arr3(0)
    msgbox Series
    Episode=left(arr3(1),len(arr3(1))-6) ' to get rid of ending "$$$%%%"
    msgbox Episode
    Quote Quote  
  4. Member mats.hogberg's Avatar
    Join Date
    Jul 2002
    Location
    Sweden (PAL)
    Search Comp PM
    Ah - good - I was just typing it out from the top of my head.

    /Mats
    Quote Quote  



Similar Threads