Jump to content

Script created browser window no longer functioning - after working for years


Recommended Posts

Morning all.  Some years ago I created a script that:

  1. Checked if a domain user needed to complete a survey
  2. If needed, presented them with a web based survey in a UI element
  3. Refused to close until they'd completed it
  4. Recorded that it was complete, so they only had to do it once.

Management loved this, staff hated it.  All was well until a couple of months ago it stopped working.  You could no longer click on the buttons in the survey.  No idea why.  I've taken the script apart, can't find anything.  You can replace the web based survey with a web page (say, BBC news) and you're golden.

At the same time, an extra scroll bar appeared, which is just confusing.

A cut down version of the script is presented below, without excess logic, but with a test survey to complete.  All the problems are visible in this test.  Issue applies to both Windows 7 and 10 hosts.  Any ideas?    I'm wondering if it's related to how the UI elements are handing scripting within websites, but....?  Thanks in advance.

#include <guiconstantsex.au3>
#include <windowsconstants.au3>
#include <IE.au3>

Pulse()

Func Pulse()
    Local $oIE, $GUIActiveX,$msg
    Local $surveylink
    Local $survey
    Local $fileflag
    Local $closeflag
    Local $checkfilepath

    $survey = -1
    $closeflag = 0

$date = @YEAR & @MON & @MDAY

    if ($date > 20200609 and $date < 20201017) Then
                            $survey = 1
            $surveylink="https://www.surveymonkey.co.uk/r/DKQPWWM"

        ; Additional logic removed

        Else
            Exit
EndIf


    ; Check if the user has completed a survey before
    ; Logic Removed

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

    ; Creates the form that is presented to the user
    GUICreate("Mandatory Punishment Survey", 1000, 580, -1,-1, 0x80000200)
    ; Creates the window that the web page is embedded within
    $GUIActiveX = GUICtrlCreateObj ($oIE, 10, 40, 975, 520)

    GUISetState();shows the Form
    $oIE.navigate($surveylink)
    $oIE.documentElement.scroll = "no"

    Sleep(10000)

; Loop until user finishes survey and uses the exist script or it is terminated
    While 1
        ;After every loop check if the user clicked something in the GUI window
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                MsgBox(0,"","Please answer the question")
            Case $msg = $GUI_EVENT_MINIMIZE
                MsgBox(0,"","Please answer the question")
            Case $msg = $GUI_EVENT_RESIZED
                MsgBox(0,"","Please answer the question")
            case else
                $url = $oIE.document.url
                ;if Not ($url == $surveylink) Then
                    if StringInStr($url,"survey",2,1) Then
                        elseif StringInStr($url,"https://google.com",2,1) Then
                        Else
                ; Logic removed controlling recording of completion
                    Exit
                    endif
        EndSelect
    WEnd
EndFunc

 

 

Link to comment
Share on other sites

This seems to be coming up a lot lately. Try adding the following to the beginning of your script --

#include <Process.au3>

Local $regValue = "0x2AF8"
; IE11 edge mode: 11001 (0x2AF9)
; IE11: 11000 (0x2AF8)
; IE10: 10001 (0x2711)
; IE10: 10000 (0x02710)
; IE 9: 9999 (0x270F)
; IE 9: 9000 (0x2328)
; IE 8: 8888 (0x22B8)
; IE 8: 8000 (0x1F40)
; IE 7: 7000 (0x1B58)

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", _ProcessGetName(@AutoItPID), "REG_DWORD", $regValue)

Code comes from here --

 

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...