WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with MSIE
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Launch Application from HTML Page


;   you can use Dynamic HTML to control MSIE via Winbatch
;   and have it run programs and run other scripts...

#DefineSubRoutine startMSIE(url)
   Browser = ObjectOpen("InternetExplorer.Application")
   Browser.addressbar = @FALSE
   Browser.statusbar = @FALSE
   Browser.menubar = @FALSE
   Browser.toolbar = @FALSE
   browser.visible = @TRUE
   browser.navigate(url)
   ; wait until page loads...
   While Browser.busy || Browser.readystate <> 4
      TimeDelay(0.5)
   EndWhile
   ; setup the document object...
   browserDoc = Browser.Document
   all = browserdoc.all
   Return(browser)
#EndSubRoutine

#DefineSubRoutine WaitForBrowser()
   While Browser.busy || Browser.readystate <> 4
      TimeDelay(0.5)
   EndWhile
   Return
#EndSubRoutine

url = "about:blank"

br = startMSIE(url)

browser.document.writeln("<h2>Make a selection</h2>")
browser.document.writeln("<br/><br/><br/>")

CalcButton = `<input type="submit" onclick="SelectSpan.innerText='CALC'" value="Run Calculator" />`
browser.document.writeln(CalcButton)

browser.document.writeln("   ")

ExitButton = `<input type="submit" onclick="SelectSpan.innerText='EXIT'" value="Exit" />`
browser.document.writeln(ExitButton)

browser.document.writeln("<br/>")

browser.document.writeln(`<span id="SelectSpan" style="display: none"></span>`)

While @TRUE
   Yields(2000)
   If browser.document.all.SelectSpan.innerText <> ""
      value = browser.document.all.SelectSpan.innerText
      browser.document.all.SelectSpan.innerText = ""
      If value == "CALC" Then Run("calc.exe", "")
      If value == "EXIT" Then Break
   EndIf
EndWhile

br.quit

Exit

Article ID:   W17181
File Created: 2007:07:03:14:28:36
Last Updated: 2007:07:03:14:28:36