Sign in to follow this  
Followers 0
mesale0077

hta file in the autoitscript

4 posts in this topic

how is work hta file inthe script,like html file,like code:

#include <IE.au3>

_IECreateEmbedded ( )

...

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <IE.au3>

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()

GUICreate("Embedded Web control Test", 640, 580, _

(@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _

$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)

$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)

$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)

$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)

$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)

$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState() ;Show GUI

$oIE.navigate(@ScriptDir & "\index.hta")<---?

; Waiting for user to close the window

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $GUI_Button_Home

$oIE.navigate(@ScriptDir & "\index.hta")<----?

Case $msg = $GUI_Button_Back

_IEAction ($oIE, "back")

Case $msg = $GUI_Button_Forward

_IEAction ($oIE, "forward")

Case $msg = $GUI_Button_Stop

_IEAction ($oIE, "stop")

EndSelect

WEnd

GUIDelete()

Exit

good works

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The .hta extension is for MS HTML Application files, which are interpreted by MSHTA.exe, not IE. The file type should already be associated with the application, so you should be able to just run:

ShellExecute(@ScriptDir & "\index.hta")

Or, like this:

$iPID = Run('mshta.exe "' & @ScriptDir & '\index.hta' & '"')

I'm not sure about trying to make it an embedded object, but you can set parent for the window. I believe there are demos already of embedding a notepad.exe window, for example, using _WinAPI_SetParent().

:)

Edit: Forgot to close parens.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

.hta's will not be embed-able like typical browser instances. You can use _IENavigate (.navigate method) to open a .hta, but a new process and new window will be created because of what PsaltyDS mentions above. You can _IEAttach to this new window, but the WinAPI suggestion is probably your best chance to embed.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

thank you

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0