fredmartinmaine
IS-IT--Management
I found this four-line vbscript fragment online someplace:
Set wShell=CreateObject("WScript.Shell")
Set oExec=wShell.Exec("mshta.exe ""about:<input type=file id=FILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
sFileToProcess = oExec.StdOut.ReadLine
msgbox "The file you selected was " & chr(13) & sFileToProcess,0,"FILE TO PROCESS"
It allows the user to pick a file using a typical Windows dialog box. It appears to start in the folder where the script is executed. I'd expect that.
Does anyone know how to set the starting path? Say, the user's Documents folder or some static location maybe?
Fred
Set wShell=CreateObject("WScript.Shell")
Set oExec=wShell.Exec("mshta.exe ""about:<input type=file id=FILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
sFileToProcess = oExec.StdOut.ReadLine
msgbox "The file you selected was " & chr(13) & sFileToProcess,0,"FILE TO PROCESS"
It allows the user to pick a file using a typical Windows dialog box. It appears to start in the folder where the script is executed. I'd expect that.
Does anyone know how to set the starting path? Say, the user's Documents folder or some static location maybe?
Fred