Jump to content

Array variable has incorrect number of subscripts or subscript dimension range exceeded.


Mucho
 Share

Recommended Posts

$ChartList = WinList ("[CLASS:TfrmCharts]");  ("", "Processing data")

If $Chartlist[1][0] <> "" And BitAND(WinGetState($Chartlist[1][1]), 2) And BitAND(WinGetState($Chartlist[1][1]), 16) Then
       WinWait("Advisor Professional  v","",1)

 

I know it is caused by an empty array, but can someone help me with the correct coding?

 

Link to comment
Share on other sites

So I tried Kovacic's suggestion as follows:

Local $ChartList = WinList("[CLASS:TfrmCharts]")
local $Chartlist[100][100]

If $Chartlist[1][0] <> "" And BitAND(WinGetState($ChartList[1][1]), 2) And BitAND(WinGetState($ChartList[1][1]), 16) then; 
    MsgBox($MB_SYSTEMMODAL, "Wait", "A chart is either minimized or not detached. Process Attached Chart", 1)
    _WinWaitActivate("Advisor Professional  v","")

Else ;( Detached Chart )               { Even though there is no detached chart, the script still execute this condition. }
    MsgBox($MB_SYSTEMMODAL, "Wait", "Process Detached Chart that is not minimized", 1)
    WinSetState ($ChartList[1][0], "", @SW_MAXIMIZE)
    MouseClick("left", 130, 40, 1,0)

EndIf

 

The array variable error is still there if there is no detached chart, that is to say no chart in the array.  If there is a minimized detached chart, then the error disappears, the script works fine.

Edited by Mucho
Link to comment
Share on other sites

Try:

$ChartList = WinList ("[CLASS:TfrmCharts]");  ("", "Processing data")
If $ChartList[0][0] Then
    If $Chartlist[1][0] <> "" And BitAND(WinGetState($Chartlist[1][1]), 2) And BitAND(WinGetState($Chartlist[1][1]), 16) Then
       WinWait("Advisor Professional  v","",1)
    EndIf
EndIf

 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

UEZ,

It does not even test either of the two conditions. BitAND(WinGetState($Chartlist[1][1]), 16) does not seem to work; it does not see that the chart is minimized, although BitAND(WinGetState($Chartlist[1][1]), 2) is ok. I do not have this problem in my office computer.

Link to comment
Share on other sites

Your condition seems to be wrong which I didn't check previously.

Try this instead:

$ChartList = WinList ("[CLASS:TfrmCharts]");  ("", "Processing data")
If $ChartList[0][0] Then
    If $Chartlist[1][0] <> "" And BitAND(WinGetState($Chartlist[1][1]), 18) = 18 Then
       WinWait("Advisor Professional  v","",1)
    EndIf
EndIf

This will check whether Wintitle is <> "" AND bits 2 and 16 are set (Window is visible & Window is minimized).

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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

×
×
  • Create New...