Jump to content

freezes always


Recommended Posts

i used the gui in help files to create one that would display a work webpage i require constatntly, and added some buttons for a few pages i need to go to often to open them in a new ie window, plus a few buttons to open programs i use. i did this as it meant i could control the window easily as i planned to use scripts and macros run with more buttons to perform regular tasks which meant everything can be written relative to active window and work no matter where or how it is moved.

but for some reason, it freezes after opening and closing sometimes or maybe say 4 new windows in ie to view other pages at which point no buttons work anymore and window cant even be closed with x button, but the displayed page in gui can still be interacted with, and guesses as to why this is.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Opt('MustDeclareVars', 1)
HotKeySet("{ESC}", "Terminate")
Example()


Func Example()
    Local $oIE, $GUIActiveX, $msg
    Local $button_blog, $button_forum, $button_contact, $button_google, $button_reppicker
    Local $button_txtconvert

    $oIE = ObjCreate("Shell.Explorer.2")


    GUICreate("My Browser....ESC to close", 1250, 700, (@DesktopWidth - 1300) / 2, (@DesktopHeight - 750) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $GUIActiveX = GUICtrlCreateObj ($oIE, 10, 40, 1200, 600)
    $button_google=GUICtrlCreateButton("google", 10, 10, 60)
    $button_forum=GUICtrlCreateButton("forum", 80, 10, 60)
    $button_blog=GUICtrlCreateButton("blog", 150, 10, 60)
    $button_contact=GUICtrlCreateButton("contact", 220, 10, 60)
    $button_txtconvert=GUICtrlCreateButton("txtconvert", 1150, 670, 60)
    $button_reppicker=GUICtrlCreateButton("reports", 1150, 640, 60)



    GUISetState()       ;Show GUI

    $oIE.navigate("http://www.autoitscript.com/site/")

    While 1
        $msg = GUIGetMsg()

        Select
            Case $msg = $button_google
                 $oIE = _IECreate ("http://www.google.com.au/")
            Case $msg = $button_forum
                 $oIE = _IECreate ("http://www.autoitscript.com/forum/")
            Case $msg = $button_blog
                 $oIE = _IECreate ("http://www.autoitscript.com/site/blog/")
            Case $msg = $button_contact
                 $oIE = _IECreate ("http://www.autoitscript.com/site/contact-us/")
            Case $msg = $button_txtconvert
                 Run("C:\Users\textcoverter")
            Case $msg = $button_reppicker
                 Run("C:\Users\reportpicker")
            Case $msg = $GUI_EVENT_CLOSE
                 ExitLoop
         EndSelect


    WEnd


EndFunc
Func Terminate()
    Exit 0
EndFunc
Link to comment
Share on other sites

Try like this

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Opt('MustDeclareVars', 1)

HotKeySet("{ESC}", "Terminate")

Global $oIE = ObjCreate("Shell.Explorer.2")

Example()


Func Example()
    Local $GUIActiveX, $msg
    Local $button_blog, $button_forum, $button_contact, $button_google, $button_reppicker
    Local $button_txtconvert

    GUICreate("My Browser....ESC to close", 1250, 700, (@DesktopWidth - 1300) / 2, (@DesktopHeight - 750) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $GUIActiveX = GUICtrlCreateObj ($oIE, 10, 40, 1200, 600)
    $button_google=GUICtrlCreateButton("google", 10, 10, 60)
    $button_forum=GUICtrlCreateButton("forum", 80, 10, 60)
    $button_blog=GUICtrlCreateButton("blog", 150, 10, 60)
    $button_contact=GUICtrlCreateButton("contact", 220, 10, 60)
    $button_txtconvert=GUICtrlCreateButton("txtconvert", 1150, 670, 60)
    $button_reppicker=GUICtrlCreateButton("reports", 1150, 640, 60)
    GUISetState()       ;Show GUI
    $oIE.navigate("http://www.autoitscript.com/site/")

    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $button_google
                 $oIE.navigate("http://www.google.com.au/")
                 _WaitWhileIEBusy ( )
            Case $button_forum
                 $oIE.navigate("http://www.autoitscript.com/forum/")
                 _WaitWhileIEBusy ( )
            Case $button_blog
                 $oIE.navigate("http://www.autoitscript.com/site/blog/")
                 _WaitWhileIEBusy ( )
            Case $button_contact
                 $oIE.navigate("http://www.autoitscript.com/site/contact-us/")
                 _WaitWhileIEBusy ( )
            Case $button_txtconvert
                 Run("C:\Users\textcoverter")
            Case $button_reppicker
                 Run("C:\Users\reportpicker")
            Case $GUI_EVENT_CLOSE
                 ExitLoop
         EndSwitch
        Sleep ( 10 )
    WEnd
EndFunc

Func _WaitWhileIEBusy ( )
    Do
        Sleep ( 100 )
    Until Not $oIE.Busy
EndFunc ;==> _WaitWhileIEBusy ( )

Func Terminate()
    Exit 0
EndFunc

the only freeze i see are due to ie loading...

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...