OiMunk Posted December 23, 2007 Share Posted December 23, 2007 (edited) I'm getting an "Error: Subscript used with non-Array variable", but only 10% of the time. Does anyone know how to make this work? This script is designed to resize two windows in relation to each other. The 3rd line has the error.Thanks, $size = WinGetPos("FX chain","") $sizeB = WinGetPos("Add FX","") If $size[2] > 1000 Then ;Check if Window is too Wide ERROR LINE WinMove("FX chain","",0,111, 999,666) ;make smaller Else WinMove("FX chain","",0,111,$size[2],$size[3]) ;leave size EndIf $FXWidth=999 If $size[2] < 888 Then $FXWidth=888 EndIf $sizeB[3]=600 ;unsure about this line, but seems to stop an array error next line WinMove("Add FX","",$FXWidth,111,$sizeB[2],$sizeB[3]) ; RESIZE ADD FX WINDOW Edited December 23, 2007 by OiMunk Link to comment Share on other sites More sharing options...
ame1011 Posted December 23, 2007 Share Posted December 23, 2007 $size = WinGetPos("FX chain","") $sizeB = WinGetPos("Add FX","") if Not @error then If $size[2] > 1000 Then ;Check if Window is too Wide ERROR LINE WinMove("FX chain","",0,111, 999,666) ;make smaller Else WinMove("FX chain","",0,111,$size[2],$size[3]) ;leave size EndIf $FXWidth=999 If $size[2] < 888 Then $FXWidth=888 EndIf $sizeB[3]=600 ;unsure about this line, but seems to stop an array error next line WinMove("Add FX","",$FXWidth,111,$sizeB[2],$sizeB[3]) ; RESIZE ADD FX WINDOW endif [font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font] Link to comment Share on other sites More sharing options...
crzftx Posted December 23, 2007 Share Posted December 23, 2007 Well, I don't know if that will work. I am by no means an expert, so don't take offense ame1011 if I'm wrong. I think @error is reset after every built-in function call. So, you would need to check @error after the first and second call of WinGetPos() Link to comment Share on other sites More sharing options...
OiMunk Posted December 23, 2007 Author Share Posted December 23, 2007 Thanks, that was an important lesson. I was trying to make a call to a Window that didn't quite exist yet Link to comment Share on other sites More sharing options...
OiMunk Posted December 23, 2007 Author Share Posted December 23, 2007 That's correct crzftx. I was lucky and it turned out the error was in the 2nd WinGetPos call, but I managed to get the same error when the 1st Window didn't exist, despite the @error. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now