Jump to content

Newb Question: non-array variable?


OiMunk
 Share

Recommended Posts

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 by OiMunk
Link to comment
Share on other sites

$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

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

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