Quote:
Originally Posted by topsy99
Thanks for your response. very generous. i tried the program but doesnt bring up html files.
It does !! I re-checked it. It does open .html / .htm files in NOTEPAD.
Have you changed the path in the script ?? It was "D:\Test\".
Quote:
Originally Posted by topsy99
i thought maybe they would come in firefox or internet explorer.
i simply want to input "ran24045.htm" and have the file come up in firefox or internet explorer or a program that reads htm not sure if notepad would do it. but the program above doesnt respond.
i changed the folder name to the appropriate one. the previous one that you did with the text files is great except it needs to now bring up an htm file.
You should have told me that you want them to be opened in IE or FF.
Anyway, we can modify the script.
Quote:
Originally Posted by topsy99
ps. tried your instruction 2404 but no response. be great to get this working
For opening, "ran24045.htm", you should input the prefix which in this case can be "ran" and not 2404 (which is suffix !).
Probably that's why you thought the script is not responding, as it would have found no files with prefix 2404 !
If you enter (let's say) "XYZ" in the dialog-box, the script displays the files : XYZ*.htm and XYZ*.html.
Quote:
Originally Posted by topsy99
Code:
Dim objFSO
Dim MyFile
Dim MyFolder
Dim objShell
Dim Prefix
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set MyFolder = objFSO.GetFolder("c:\horses\form")
Set objShell = WScript.CreateObject("WScript.Shell")
Prefix = InputBox("(*) Enter prefix for file-names (e.g. for opening 0310*.html or 0310*.htm files, enter 0310) :"+vbcrlf+vbcrlf+"(*) Leaving this blank or, clicking cancel will open *.html or *.htm files ...", "File-Name Prefix")
For Each MyFile In MyFolder.Files
If (Right(MyFile.Path,4) = ".htm" Or Right(MyFile.Path,5) = ".html") And Left(MyFile.Name,Len(Prefix)) = Prefix Then
objShell.Run("notepad " + MyFile.Path)
End If
Next
can you see anything wrong.
Nope, nothing wrong ... but you need to modify it as follows for opening pages in FF/IE.
For Internet Explorer ::
Code: VB
Dim objFSO
Dim MyFile
Dim MyFolder
Dim objShell
Dim Prefix
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set MyFolder = objFSO.GetFolder("c:\horses\form")
Set objShell = WScript.CreateObject("WScript.Shell")
Prefix = InputBox("(*) Enter prefix for file-names (e.g. for opening 0310*.html or 0310*.htm files, enter 0310) :"+vbcrlf+vbcrlf+"(*) Leaving this blank or, clicking cancel will open *.html or *.htm files ...", "File-Name Prefix")
For Each MyFile In MyFolder.Files
If (Right(MyFile.Path,4) = ".htm" Or Right(MyFile.Path,5) = ".html") And Left(MyFile.Name,Len(Prefix)) = Prefix Then
objShell.Run("iexplore " + chr(34)+MyFile.Path+chr(34))
End If
Next
For Firefox ::
Code: VB
Dim objFSO
Dim MyFile
Dim MyFolder
Dim objShell
Dim Prefix
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set MyFolder = objFSO.GetFolder("c:\horses\form")
Set objShell = WScript.CreateObject("WScript.Shell")
Prefix = InputBox("(*) Enter prefix for file-names (e.g. for opening 0310*.html or 0310*.htm files, enter 0310) :"+vbcrlf+vbcrlf+"(*) Leaving this blank or, clicking cancel will open *.html or *.htm files ...", "File-Name Prefix")
For Each MyFile In MyFolder.Files
If (Right(MyFile.Path,4) = ".htm" Or Right(MyFile.Path,5) = ".html") And Left(MyFile.Name,Len(Prefix)) = Prefix Then
objShell.Run("firefox " + chr(34)+MyFile.Path+chr(34))
End If
Next
I have tested both of them before posting .. they MUST work. [

]