Jump to content

Subscript used with non-Array Variable


Recommended Posts

For my work i created 2 files. One called VDIGUI and one called VDICHECK. The VDIGUI creates an window with a webpage loaded in it. Because we couldn't run IE in kiosk mode because that closed of too much functionality. Now sometimes i get the error which is in the title on line 6087. I only get this one when i boot the pc. Not when the script is already running.

I searched through topics to find it and the only i could find was Here it is said that a function calls something that either doesn't exist or an element that isn't an array.

Could someone help me to go through this code and find out where the problem is? The problem in the line is in the VDIGUI according to the error. Some codes are from other users or which users posted. That are the hiding of the button on the toolbar and how to load in the webpage. They are referred to in the comment section.

VDICHECK

#NoTrayIcon

Opt("WinTitleMatchMode",2)

Func close1()
    WinKill ( "Resolution was changed" )
    sleep ( 50 )
    ProcessClose ( "vdigui.exe" )
EndFunc

Func close2()
    WinKill ( "", "Language" )
    MsgBox (16, "Restrictions", "This operation has been cancelled due to restrictions in effect on this computer. Please contact your administrator." )
EndFunc

Func close3()
    WinKill ( "Sounds" )
    MsgBox (16, "Restrictions", "This operation has been cancelled due to restrictions in effect on this computer. Please contact your administrator." )
EndFunc

Func close4() 
    WinKill ( "", "SW Synth" )
    MsgBox (16, "Restrictions", "This operation has been cancelled due to restrictions in effect on this computer. Please contact your administrator." )
EndFunc

Func close5()
    WinKill ( "", "Windows" )
EndFunc

Func close6()
    WinKill ( "Found New Hardware Wizard" )
EndFunc

Func close7()
    Send ( "#N" )
EndFunc

Func close8()
    WinSetOnTop ( "Login device DTLocker", "", 1 )
EndFunc

Func close9()
    WinKill ( "Found New Hardware" )
EndFunc

Func close10()
    WinKill ( "", "FolderView" )
EndFunc

Func close11()
    WinKill ( "AutoIt Error" )
EndFunc

While 1
    $case=WinGetTitle("")
    $case1=WinGetText("", "" )
    If StringInStr($case, "Resolution was changed") Then close1()
    If StringInStr($case1, "Language") Then close2()
    If StringInStr($case, "Sounds") Then close3()
    If StringInStr($case1, "SW Synth") Then close4()
    If StringInStr($case, "Login device DTLocker") Then close8()
    If StringInStr($case1, "Windows") Then close5()
    If StringInStr($case, "Wizard") Then close6()
    If StringInStr($case, "Hardware") Then close9()
    If StringInStr($case, "Change") Then close7()
    If StringInStr($case1, "FolderView") Then close10()
    If StringInStr($case, "AutoIt Error") Then close11()
    If ProcessExists ( "vdigui.exe" ) = 0 Then Run ( "vdigui.exe" )
    If ProcessExists ( "QuickRes2.exe" ) = 0 Then Run ( "QuickRes2.exe" )
        sleep ( 100 )
    WEnd

VDIGUI

#include <GUIConstants.au3>
#include <IE.au3>
#NoTrayIcon
#Include <GuiToolBar.au3>

$taskbar = WinGetPos("","Notification Area")
$x = @DesktopWidth ;defineert $x
$y = @DesktopHeight - $taskbar[3] ;defineert $y

$GUI = GUICreate("VDI", $x, $y, -3, -22)
$object = ObjCreate("Shell.Explorer.2")
$object_ctrl = GUICtrlCreateObj($object, 0, 0, @DesktopWidth, @DesktopHeight)
_IENavigate($object, "werkplek")
GUISetState()

WinWaitActive("VDI")
_TaskbarHideButton ( "VDI" )

Func _TaskbarHideButton($sText, $bHide = True)
    $hToolbar = _GUICtrlToolbar_FindToolbar("[CLASS:Shell_TrayWnd]", $sText)
    If $hToolbar = 0 Then Return False
    For $i = 0 To _GUICtrlToolbar_ButtonCount($hToolbar)-1
        $cId = _GUICtrlToolbar_IndexToCommand($hToolbar, $i)
        If _GUICtrlToolbar_GetButtonText($hToolbar, $cId) = $sText Then
            Return _GUICtrlToolbar_HideButton($hToolbar, $cId, $bHide)
        EndIf
    Next
    Return False
EndFunc

While 1 ;begint een constante
    $msg = GUIGetMsg()
    If ProcessExists ( "vdicheck.exe" ) = 0 Then Run ( "vdicheck.exe" )
    sleep ( 100 )
WEnd
Edited by speeder
Link to comment
Share on other sites

may be $taskbar[3] is wrong, and window is not found...

winwait ("","Notification Area")
Do
    Sleep ( 500 )
    $taskbar = WinGetPos("","Notification Area") ; no title ?
Until not @error
$x = @DesktopWidth ;defineert $x
$y = @DesktopHeight - $taskbar[3] ;defineert $y

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

Link to comment
Share on other sites

may be $taskbar[3] is wrong, and window is not found...

winwait ("","Notification Area")
Do
    Sleep ( 500 )
    $taskbar = WinGetPos("","Notification Area") ; no title ?
Until not @error
$x = @DesktopWidth ;defineert $x
$y = @DesktopHeight - $taskbar[3] ;defineert $y

Hm never thought about that. I'm gonna try. Thanks in advance.

Update: Until now, no errors found. It's in a rebooting sequence, so hopefully it is fixed now.

Edited by speeder
Link to comment
Share on other sites

Not too hard, It's the only Array Variable ! Posted Image

It is fixed indeed. I was busy so long finding what was wrong. First i thought the VDICHECK so i made that one in an other way than the original i had. Then it was fixed but later on the error still came back.

Link to comment
Share on other sites

It is fixed indeed. I was busy so long finding what was wrong. First i thought the VDICHECK so i made that one in an other way than the original i had. Then it was fixed but later on the error still came back.

In fact when you write : I only get this one when i boot the pc. Not when the script is already running.

I thought the explorer was not yet fully operational, and crash WinGetPos func !

Glad to help you ! Posted Image

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