简体   繁体   English

我如何使用window_onload从html应用程序中打开文件

[英]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> . 我在</head><body>之间的hta应用程序中有此脚本。

And it does work: it resizes and opens the wav files. 它确实起作用:它会调整大小并打开wav文件。 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. 但是在打开wav文件之前,我希望它加载一种类似于广告弹出窗口的文件,如果您愿意的话,它将作为另一个hta窗口打开。 How would I add the necessary lines of code to make it open say ad.hta before playing the .wav files? 在播放.wav文件之前,如何添加必要的代码行以使其打开并显示ad.hta?

<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 工作正常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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