VBScript - Subtract one text file value from another

Associate
Joined
9 Sep 2008
Posts
40
Location
Moira, East Midlands
Only me!

I've just moved the bed in as I can see this being my second home now! ;)

I have 2 text files with one numerical value each (i.e. 54338). I would like to get another script to take one value and subtract it from the other, and have this resultant value written to a new (3rd) text file.

what I have is:

Const ForReading = 1

strComputer = "."

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile1 = objFSO.OpenTextFile("..\freespacebefore.txt", ForReading)
objFile1.Close

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile2 = objFSO.OpenTextFile("..\freespaceafter.txt", ForReading)
objFile2.Close

Set objFile3 = objFSO.CreateTextFile("..\savedspace.txt")
objFile3.WriteLine "savedspace=" & (objFile2-objFile1)
objFile3.Close


The error message I am getting is 'Object doesn't support this property or method' - refering to the highlighted text.
Help me Obi Wan......
 
That makes sense, a newbie error! :rolleyes:

I'm getting: Type mismatch: 'iFile1Value' error though.

i checked on M$ website and they detailed an issue with using adNumeric functions - but I tried the CDbl and CInt functions - nada, nyet & zilch!

:confused:
 
My text files had 'savedspace=' set as initial content in each one, so that Flash could use this as the variable it needed.

Trying to delete text (and not numericals) from one another was causing the issue. I just created another text file from the original, appending the 'savedspace=' into it and voila!
 
Back
Top Bottom