Sign in to follow this  
Followers 0
Lemmens Peter

Problem with embedded Internet Explorer

5 posts in this topic

Hi everybody,

I need your help.

I need to create an AutoIt-script that has an embedded Internet Explorer. (I got this - see code)

Problem 1 : But without the possibility to close it (no cross on the upper right corner of the application)

Problem 2 : If the hidden text contains a specific text the application should close.

Can anybody help me ?

Thank you,

Peter

#NoTrayIcon
   Dim $objExplorer
   Dim $Win_Title
   $Site_URL = "http://Test:8080"
   $Site_Titel = "Test - Windows Internet Explorer"
   $objExplorer = ObjCreate("InternetExplorer.Application")
   $objExplorer.ToolBar = 0
   $objExplorer.StatusBar = 0
   $objExplorer.Width = @DesktopWidth
   $objExplorer.Height = @DesktopHeight
   $objExplorer.Left = 0
   $objExplorer.Top = 0
   $objExplorer.Visible = 1
   $objExplorer.Navigate($Site_URL)
   While $objExplorer.busy
      Sleep(100)
   WEnd
   Sleep(5000)
   Local $HWND = WinGetHandle($Site_Titel)
   Local $sHWND = String($HWND)
   If WinGetState(HWnd($sHWND)) <> @SW_MAXIMIZE Then
      WinSetState(HWnd($sHWND), "", @SW_MAXIMIZE)
   EndIf
   While WinExists(HWnd($sHWND))
      ; If hiddentext contains "Logout" exit while loop
      Sleep(500)
   WEnd

Share this post


Link to post
Share on other sites



#NoTrayIcon
#include <Constants.au3>
#include <IE.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
HotKeySet('!{F4}', 'DoNothing')

Opt('MustDeclareVars', 1)

Dim $objExplorer
Dim $Site_URL = "http://test:8080", $Site_Titel = "Test - Windows Internet Explorer"
Dim $Win_Title
Dim $iStyle
Dim $HWND

$objExplorer = ObjCreate("InternetExplorer.Application")
$objExplorer.ToolBar = 0
$objExplorer.StatusBar = 0
$objExplorer.Width = 200
$objExplorer.Height = 200
$objExplorer.Left = 0
$objExplorer.Top = 0
$objExplorer.Visible = 1

$HWND = HWnd($objExplorer.HWND)

$iStyle = _WinAPI_GetWindowLong($HWND, $GWL_STYLE)
_WinAPI_SetWindowLong($HWND, $GWL_STYLE, BitOR(BitAND($iStyle, BitNOT($WS_OVERLAPPEDWINDOW)), $WS_POPUP))

WinSetState($HWND, "", @SW_MAXIMIZE)
HotKeySet('{ESC}', '_EXIT')


$objExplorer.Navigate('http://www.google.com')
While $objExplorer.Busy
    Sleep(150)
WEnd

While WinExists($HWND)
    Sleep(100)
WEnd

Exit

Func _EXIT()
    WinClose($HWND)
EndFunc

Func DoNothing()
EndFunc

The _WinAPI_SetWindowLong() task can be done by setting the TheaterMode or FullScreen properties of the object to true, but it's not the same as disabling the window caption bar.

Share this post


Link to post
Share on other sites

#NoTrayIcon
#include <Constants.au3>
#include <IE.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
HotKeySet('!{F4}', 'DoNothing')

Opt('MustDeclareVars', 1)

Dim $objExplorer
Dim $Site_URL = "http://test:8080", $Site_Titel = "Test - Windows Internet Explorer"
Dim $Win_Title
Dim $iStyle
Dim $HWND

$objExplorer = ObjCreate("InternetExplorer.Application")
$objExplorer.ToolBar = 0
$objExplorer.StatusBar = 0
$objExplorer.Width = 200
$objExplorer.Height = 200
$objExplorer.Left = 0
$objExplorer.Top = 0
$objExplorer.Visible = 1

$HWND = HWnd($objExplorer.HWND)

$iStyle = _WinAPI_GetWindowLong($HWND, $GWL_STYLE)
_WinAPI_SetWindowLong($HWND, $GWL_STYLE, BitOR(BitAND($iStyle, BitNOT($WS_OVERLAPPEDWINDOW)), $WS_POPUP))

WinSetState($HWND, "", @SW_MAXIMIZE)
HotKeySet('{ESC}', '_EXIT')


$objExplorer.Navigate('http://www.google.com')
While $objExplorer.Busy
    Sleep(150)
WEnd

While WinExists($HWND)
    Sleep(100)
WEnd

Exit

Func _EXIT()
    WinClose($HWND)
EndFunc

Func DoNothing()
EndFunc

The _WinAPI_SetWindowLong() task can be done by setting the TheaterMode or FullScreen properties of the object to true, but it's not the same as disabling the window caption bar.

One question, how can I know all the functions about the object $objExplorer?

Share this post


Link to post
Share on other sites

There is already a library DaleHohm wrote, it's an automation for the InternetExplorer.Application and Shell.Explorer.2 objects. If you want to know the object hierarchy, you need to search MSDN for InternetExplorer.Application, for example, or get yourself object browser. Have no link, sorry.

Share this post


Link to post
Share on other sites

One question, how can I know all the functions about the object $objExplorer?

Look in my sig. Also, either use or read IE.au3

Dale


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

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