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
+ Reply to Thread
Results 1 to 4 of 4
-
-
First, split it with "!!!" as the delimiter.
Code:dim arr arr=split(lineoftext,"!!!") filename=arr(0)
Code:arr=split(arr(1),"@@@") encodeype=arr(0)
Code:arr=split(arr(1),"###") Series=arr(0) Episode=left(arr(1),len(arr(1))-6) ' to get rid of ending "$$$%%%"
-
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 -
Ah - good - I was just typing it out from the top of my head.
/Mats
Similar Threads
-
Which variables make best video quality in MKVs? bitrate/profile/ref frames
By dave in or in forum Video ConversionReplies: 9Last Post: 1st Mar 2012, 15:25 -
slides to DVD, cannot read text!
By jaybird in forum Video ConversionReplies: 3Last Post: 7th Jun 2011, 12:43 -
Read text create audio and convert text to synced subtitles in mp4
By Philip Lean in forum SubtitleReplies: 1Last Post: 25th Feb 2010, 08:54 -
looking for good OCR software that will convert text in jpg to regular text
By jimdagys in forum ComputerReplies: 6Last Post: 27th Jun 2008, 10:38 -
Substituting Variables in a Wiki Template
By thecoalman in forum ComputerReplies: 1Last Post: 14th Jul 2007, 04:00