Minor WSH issues

EminoMeneko Posted messages 2499 Status Member -  
EminoMeneko Posted messages 2499 Status Member -
Hello,
I wanted to write a script that extracts URLs ending in pls or asx to create a simple m3u playlist.
It's a bit of a rushed script (so sorry if it's not very well structured), but my issue is as follows:
I have two text files from which I am making my searches.
One is the complete file of what interests me, the other is just the beginning (they are respectively 300KB and 15KB)
So what's strange is that with my smaller file it works perfectly but with the other one it doesn't work anymore... xD

Here is my source
 Option Explicit Dim fso, fi, fo, line, pattern, result Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set pattern = new RegExp pattern.pattern="(.*)(http.*(pls|asx))(.*)" Set fso = CreateObject("Scripting.FileSystemObject") Set fi = fso.OpenTextFile("sourcedifm.txt", ForReading, True) Set fo = fso.OpenTextFile("result.txt", ForWriting, True) 'Wscript.Echo "The procedure may take a while. Please confirm and wait." Do Until fi.AtEndOfStream line = fi.ReadLine 'WScript.Echo line Set result = pattern.Execute(line) If result.Count >= 1 Then 'Wscript.Echo result.Item(0).SubMatches(1) fo.WriteLine result.Item(0).SubMatches(1) End If Loop Wscript.Echo "End of the script!" fi.Close fo.Close Set fso = Nothing 


Another thing. I would like to use Open and Save As dialog boxes, but what I found on the net doesn't work on Seven and it seems that this has been the case since Vista. If you know how to do it simply, thank you for leaving your answer.

Thanks in advance.

1 answer

  1. EminoMeneko Posted messages 2499 Status Member 318
     
    It just worked... -_-
    By copying the entire first file to the second one, I conclude that it’s the file that’s not really formatted in a way that’s compatible with WSH.
    As for the rest, the question still stands. ;)
    0