简体   繁体   中英

how do i open a file from a html application using window_onload

I have this script in my hta application between </head> and <body> .

And it does work: it resizes and opens the wav files. But before it opens the wav files, I want it to load a file kind of like an ad popup if you will that will open as another hta window. How would I add the necessary lines of code to make it open say ad.hta before playing the .wav files?

<script language="VBScript">
Sub Window_OnLoad
Dim width,height
width=470
height=400
self.ResizeTo width,height
Set objVoice = CreateObject("SAPI.SpVoice")
Set objFile = CreateObject("SAPI.SpFileStream.1")
objFile.Open "111(2).wav"
objVoice.Speakstream objFile
Set objVoice = CreateObject("SAPI.SpVoice")
Set objFile = CreateObject("SAPI.SpFileStream.1")
objFile.Open "11537.wav"
objVoice.Speakstream objFile
End Sub
</script>

I have tried this:

Const NORMAL_WINDOW = 1
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "notepad.exe", "test.txt", , , NORMAL_WINDOW

Putting that just after the

self.ResizeTo width,height

The resulting action is in this order:

Program Opens,

Error continue running scripts shows

Text file opens

Audio Plays

But the program wont do what its supposed to do after that. My text to speech function breaks.

I figured it out i did have to use

Const NORMAL_WINDOW = 1
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "notepad.exe", "test.txt", , , NORMAL_WINDOW

Got it working

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM