Jump to content

Recommended Posts

Posted

Alright, so I'm automating the opening, and navigation to two addresses with IE10

I'm using this code:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=ScreenNavTool.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnEsc", 1)
Opt("MouseCoordMode", 2)
Opt("TrayIconHide", 1)

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


Global $Taddress = "REDACTED"
Global $PLaddress = @ScriptDir & "\index.html"
Global $MouseOriginX=@DesktopWidth-13
Global $MouseOriginY=@DesktopHeight-28
Global $MouseAct=False
$w=1

$oIE = _IECreate ($Taddress)
_IEPropertySet( $oIE, "theatermode", True)
_IEPropertySet( $oIE, "toolbar", False)

While 1

    $pos = MouseGetPos()

    if $w=1 then
        $x=$pos[0]+1
        $y=$pos[1]+1
        $w=0
    else
        $x=$pos[0]-1
        $y=$pos[1]-1
        $w=1
    EndIf

    MouseMove($x, $y)

    If Not WinExists("[CLASS:IEFrame]") Then MainGUIClose()

    _Tickets()
WEnd

Func _Tickets()
    _IENavigate($oIE, $Taddress, 0)
    Sleep(30000)
    _PL()
EndFunc

Func _PL()
    _IENavigate($oIE, $PLaddress, 0)
    If $MouseAct=False Then
        MouseMove(@DesktopWidth/2, @DesktopHeight/2)
        Sleep(100)
        MouseClick("")
        Sleep(100)
        MouseMove(@DesktopWidth-25, @DesktopHeight-5)
        $MouseAct=True
    EndIf
    Sleep(10000)
    MouseWheel("down", 1)
    Sleep(10000)
    MouseWheel("down", 1)
    Sleep(10000)
    MouseWheel("down", 1)
    Sleep(10000)
    _Tickets()
EndFunc

Func MainGUIClose()
    If @Compiled Then
        ProcessClose("ScreenNavTool.exe")
    EndIf
    Exit
EndFunc   ;==>MainGUIClose

It works perfectly on my system (Windows 7 pro x64bit, Autoit 3.3.8.1, IE10.0.9200.16720) no matter if it is ran from Scite, a right click & run script, or compiled. They all three work as coded on my system.

Now, if I take it and move it to another system (Windows 7 Home Premium x64bit, Autoit 3.3.8.1, IE10.0.9200.16720) Then it runs, opens a new IE window, navigates to the starter address, sets the window to theatermode, disables the toolbar, then runs _Tickets(), moves on to _PL(), then hangs up and does not loop back to _Tickets() instead giving an error of:

IE.au3 V2.4-0 Error from function _IENavigate, $_IEStatus_InvalidObjectType

But the thing is it works the first two times it's called in the script then it errors out and does not work afterwards....

 

any ideas?

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Posted (edited)

That was actually the structure of my code previously and it presented the same errors...

I changed my code to perform differently:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=ScreenNavTool.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnEsc", 1)
Opt("MouseCoordMode", 2)
Opt("TrayIconHide", 1)

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


Global $Taddress = "http://intranet.stormcopper.com/it/Lists/IT%20Ticketing%20System/Current%20Tickets.aspx?View={E2252C6D-7E06-47D3-AF67-959660961F35}&FilterField1=Priority&FilterValue1=%281%29%20High"
Global $PLaddress = @ScriptDir & "\index.html"
Global $MouseOriginX=@DesktopWidth-13
Global $MouseOriginY=@DesktopHeight-28
Global $MouseAct=False
$w=1


$oIE2 = _IECreate ($PLaddress)
$hIE2= _IEPropertyGet($oIE2, "hwnd")

$oIE = _IECreate ($Taddress)
$hIE1= _IEPropertyGet($oIE, "hwnd")
_IEPropertySet( $oIE, "theatermode", True)
_IEPropertySet( $oIE, "toolbar", False)


While 1
    Sleep(10)
    $pos = MouseGetPos()

    if $w=1 then
        $x=$pos[0]+1
        $y=$pos[1]+1
        $w=0
    else
        $x=$pos[0]-1
        $y=$pos[1]-1
        $w=1
    EndIf

    MouseMove($x, $y)

    If Not WinExists("[CLASS:IEFrame]") Then MainGUIClose()

    _Tickets()
WEnd

Func _Tickets()
    WinActivate($hIE1)
    _IEPropertySet( $oIE2, "theatermode", False)
    _IEPropertySet( $oIE2, "toolbar", True)
    _IEPropertySet( $oIE, "theatermode", True)
    _IEPropertySet( $oIE, "toolbar", False)
    _IEAction($oIE, "refresh")
    Sleep(30000)
    _PL()
EndFunc

Func _PL()
    WinActivate($hIE2)
    _IEAction($oIE2, "focus")
    _IEPropertySet( $oIE, "theatermode", False)
    _IEPropertySet( $oIE, "toolbar", True)
    _IEPropertySet( $oIE2, "theatermode", True)
    _IEPropertySet( $oIE2, "toolbar", False)
    If $MouseAct=False Then
        MouseMove(@DesktopWidth/2, @DesktopHeight/2)
        Sleep(100)
        MouseClick("")
        Sleep(100)
        MouseMove(@DesktopWidth-25, @DesktopHeight-5)
        $MouseAct=True
    EndIf
    Sleep(10000)
    MouseWheel("down", 1)
    Sleep(10000)
    MouseWheel("down", 1)
    Sleep(10000)
    MouseWheel("down", 1)
    Sleep(10000)
    MouseWheel("down", 1)
    Sleep(10000)
    _Tickets()
EndFunc

Func MainGUIClose()
    ProcessClose("Autoit3.exe")
    ProcessClose("iexplorer.exe")
    If @Compiled Then
        ProcessClose("ScreenNavTool.exe")
    EndIf
    Exit
EndFunc   ;==>MainGUIClose

This code works on my system... but not on the home premium.

Edited by Wombat

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Posted

Made them, and the console errors out at line 580 of the IE.au3 and line 624

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

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
×
×
  • Create New...