Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Sometimes an error with Subscript used with non-Array variable

$
0
0

I have a puzzling error i can't seem to figure out.  I have a rather simple toolbar i made for aiding with windows installs to make the WinPE a little more robust.  When i run the following script from my desktop of a regular Windows install or from a Winbuilder WinPE it runs fine and without error.   If i run the same script from a vanilla (non-modified) boot.wim (no desktop environment) it has the "Subscript used with non-Array variable" error.  Its a bit of a bummer because its the vanilla boot.wim that could really benefit from the toolbar.  The only difference between the 2 environments i can think of is one has the desktop environment and the other doesn't.  I do use a setting to have the toolbar reside above the taskbar, but the vanilla boot.wim doesn't have a taskbar.  Could that be the problem, and if so, is there an easy remedy to have it function in both scenarios?

AutoIt         
#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Files\OSInstaller.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#NoTrayIcon #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> Sleep(4000) If _Singleton("1", 1) = 0 Then     Exit EndIf ;Delete FileDelete("x:\Users\Public\Desktop\desktop.ini") FileDelete("x:\Windows\system32\config\systemprofile\desktop\desktop.ini") ;Shortcuts If FileExists("x:\windows\explorer.exe") Then     FileCreateShortcut("x:\sources\recovery\StartRep.exe", @DesktopCommonDir & "\Startup Repair.lnk", "x:\Windows\system32", @SW_SHOWNORMAL) EndIf If FileExists("x:\windows\explorer.exe") Then     FileCreateShortcut("x:\windows\system32\Runsetup.exe", @DesktopCommonDir & "\WinPE Taskbar.lnk", "x:\Windows\system32", @SW_SHOWNORMAL) EndIf ;Example() ;Func Example() Local $hGUI = GUICreate('WinPE Taskbar', 484, 26, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg($WM_NCHITTEST, 'WinPE Taskbar') $aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd]", "") $aWin = WinGetPos($hGUI) WinMove($hGUI, "", @DesktopWidth - $aWin[2] - 4, @DesktopHeight - $aWin[3] - $aTaskbar[3] - 4) GUISetFont(6, 400, 0, "MS Sans Serif") GUISetBkColor(0x006020) $Button1 = GUICtrlCreateButton("Install OS", 0, 0, 59, 25) $Button2 = GUICtrlCreateButton("DART", 200, 0, 43, 25) $Button3 = GUICtrlCreateButton("Startup Repair", 240, 0, 83, 25) $Button4 = GUICtrlCreateButton("Recovery", 320, 0, 59, 25) $Button5 = GUICtrlCreateButton("Desktop", 376, 0, 59, 25) $Button6 = GUICtrlCreateButton("Explorer", 152, 0, 51, 25) $Button7 = GUICtrlCreateButton("Internet", 104, 0, 51, 25) $Button8 = GUICtrlCreateButton("ssWPI", 56, 0, 51, 25) $Button9 = GUICtrlCreateButton("Reboot", 432, 0, 51, 25) WinSetOnTop($hGUI, "", 1) While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             ;Run("x:\Windows\system32\TASKBAR_EXIT_" & @OSArch & ".exe")             Exit         Case $Button1 ;Os Gui             If FileExists("x:\windows\system32\OS_" & @OSArch & ".exe") = 1 Then                 Run("x:\windows\system32\OS_" & @OSArch & ".exe")             EndIf             If FileExists("x:\windows\system32\OS_" & @OSArch & ".exe") = 0 Then                 $Test = Asc("A")                 For $Tem = 2 To 25                     If FileExists(Chr($Test + $Tem) & ":\sources\$OEM$\OS_" & @OSArch & ".exe") Then                         $CDDRIVE = Chr($Test + $Tem) & ":"                         If FileExists($CDDRIVE & "\sources\$OEM$\OS_" & @OSArch & ".exe") = 1 Then                             Run($CDDRIVE & "\sources\$OEM$\OS_" & @OSArch & ".exe")                         EndIf                         ExitLoop                     EndIf                 Next             EndIf         Case $Button2 ; DART             Run("x:\sources\recovery\tools\MSDartTools.exe")         Case $Button3 ;Startup Repair             Run("x:\sources\recovery\StartRep.exe")         Case $Button4 ;Recovery Env             Run("x:\sources\recovery\RecEnv.exe")         Case $Button5 ; Desktop             Local $ShellObj = ObjCreate("Shell.Application")             $ShellObj.ToggleDesktop()         Case $Button6;  Explorer             If FileExists(@WindowsDir & "\explorer.exe") = 1 Then                 Run(@WindowsDir & "\explorer.exe")             EndIf             If FileExists(@WindowsDir & "\explorer.exe") = 0 Then                 $Test1 = Asc("A")                 For $Tem1 = 2 To 25                     If FileExists(Chr($Test1 + $Tem1) & ":\boot\firadisk\explorer_" & @OSArch & ".exe") Then                         $CDDRIVE2 = Chr($Test1 + $Tem1) & ":"                         If FileExists($CDDRIVE2 & "\boot\firadisk\explorer_" & @OSArch & ".exe") = 1 Then                             Run($CDDRIVE2 & "\boot\firadisk\explorer_" & @OSArch & ".exe")                         EndIf                         ExitLoop                     EndIf                 Next             EndIf         Case $Button7 ; internet             If FileExists("x:\Program Files\Internet Explorer\iexplore.exe") = 0 Then                 Run("x:\Program Files\Opera12\opera.exe")                 Run("x:\Program Files\CD-Opera\opera.exe")             EndIf             If FileExists("x:\Program Files\Internet Explorer\iexplore.exe") = 1 Then                 Run("x:\Program Files\Internet Explorer\iexplore.exe")             EndIf         Case $Button8 ; sswpi             $Test2 = Asc("A")             For $Tem2 = 2 To 25                 If FileExists(Chr($Test2 + $Tem2) & ":\ssAppsInstalls\ssWPIInstaller\ssWPI.exe") Then                     $sswpi = Chr($Test2 + $Tem2) & ":"                     If FileExists($sswpi & "\ssAppsInstalls\ssWPIInstaller\ssWPI.exe") = 1 Then                         Run($sswpi & "\ssAppsInstalls\ssWPIInstaller\ssWPI.exe")                     EndIf                     ExitLoop                 EndIf             Next         Case $Button9 ; reboot             Run("x:\windows\system32\wpeutil REBOOT")     EndSwitch WEnd GUIDelete($hGUI) ;EndFunc   ;==>Example Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)     #forceref $hWnd, $iMsg, $wParam, $lParam     Return $HTCAPTION EndFunc   ;==>WM_NCHITTEST

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>