I searched a lot in google to find a good method to show a file open dialog using vbScript. Eventhough there was some method already available, those were have limitations which makes the method not useful in many cases.
So I created this exe which will take some information as command line parameter and writes the file name to iostream. This information can be now read using the script and be used.
Example for Open File
Example for Save File
Screenshots
You can download the example scripts here. I have also published a post about another script which uses this technique.
So I created this exe which will take some information as command line parameter and writes the file name to iostream. This information can be now read using the script and be used.
Example for Open File
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | Dim objWshShell, objExec Dim strExecCmd Dim tmp strExecCmd = """" & strScriptPath & "OpnFile.exe""" strExecCmd = strExecCmd & " ""1""""Hex File (*.hex)""""*.hex""""Hex""""Open Hex File""" Set objWshShell = CreateObject("WScript.Shell") Set objExec = objWshShell.Exec(strExecCmd) Do While objExec.Status = 0 WScript.Sleep 100 Loop If objExec.ExitCode = 0 Then tmp = Split(objExec.StdOut.ReadLine(), "~") strHexFile = tmp(0) MsgBox "Save file " & strHexFile Else WScript.Quit End If |
Example for Save File
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | Dim objWshShell, objExec Dim strExecCmd Dim tmp strExecCmd = """" & strScriptPath & "OpnFile.exe""" strExecCmd = strExecCmd & " ""0""""Hex File (*.hex)""""*.hex""""Hex""""Save Hex File""" Set objWshShell = CreateObject("WScript.Shell") Set objExec = objWshShell.Exec(strExecCmd) Do While objExec.Status = 0 WScript.Sleep 100 Loop If objExec.ExitCode = 0 Then tmp = Split(objExec.StdOut.ReadLine(), "~") strHexFile = tmp(0) MsgBox "Save file " & strHexFile Else WScript.Quit End If |
Screenshots
You can download the example scripts here. I have also published a post about another script which uses this technique.
Related Post
Like this page on facebook
1 comments:
It is truely interesting post, but I do not see everything completely clear, especially for someone not involved in that topic. Anyway very interesting to me.
pst recovery
Post a Comment