| |
ehvbs
Posts: 2114
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
|
I'm not sure about the environment your script has to run in, but this: <html> <head> <hta:application id = "filedialog" /> <title>filedialog</title> <meta http-equiv = "content-script-type" content = "text/vbscript"/> <script language = "VBScript" type = "text/vbscript" > '<![CDATA[ ''= calls FileOpenDialog and sets sleTOSEND.value ' ============================================================================ Sub doFileOpenDialog() Dim oCDlg Dim sTmp Set oCDlg = CreateObject( "MSComDlg.CommonDialog" ) If oCDlg Is Nothing Then MsgBox "CreateObject( 'MSComDlg.CommonDialog' ) failed." Exit Sub End If oCDlg.MaxFileSize = 10000 ' Setting other oCDlg.Properties ' oCDlg.Filter = ... ' ... oCDlg.ShowOpen document.all.sleTOSEND.value = oCDlg.Filename ' FSpec End Sub ''= checks for FSpecs and calls (fake)Send ' ============================================================================ Sub doSend() Dim bNix Dim sFSpec bNix = True sFSpec = document.all.filTOSEND.value If "" <> Trim( sFSpec ) Then fakeSend sFSpec bNix = False End If sFSpec = document.all.sleTOSEND.value If "" <> Trim( sFSpec ) Then fakeSend sFSpec bNix = False End If If bNix Then MsgBox "Please specify at least one file to send." End If End Sub ''= fakes sending file sFSpec to a remote machine for processing ' ============================================================================ Sub fakeSend( sFSpec ) MsgBox "About to send: " + vbCrLf _ + sFSpec + vbCrLf _ + "to a remote computer" End Sub ''= refreshes the HTA page, which includes re-running any Windows_Onload code ' ============================================================================ Sub reloadHTA() location.reload( True ) End Sub ']]> </script> </head> <body> <input type = "FILE" id = "filTOSEND"> <hr /> <input type = "TEXT" id = "sleTOSEND"> <input type = "BUTTON" onclick = "doFileOpenDialog()" value = "Choose file to send"> <hr /> <input type = "BUTTON" value = "send file to remote computer" onclick = "doSend()"> <hr /> <input type = "BUTTON" value = "reload" onclick = "reloadHTA()"> </body> </html> runs on my W 2000 machine. For compatibility and amount-of-work reasons I would stick with the INPUT/FILE approach.
|
|