Jump to content

Script not working on Win10


Recommended Posts

Folks,

I am dealing with an ambiguous behavior of a script that builds a listview from an INI file section. I used the code examples provided by AndrewDaoust and Melba23 on the forum.

I use a Windows 7 Ultimate 64-bit laptop where I have both AutoIt3 versions 3.3.14.5 and 3.3.15.0 Beta, all producing the same behavior.

I start by getting the INI file section into an array:

Global $aArray = IniReadSection($sFilePath, $sSection)

After creating the listview I populate it using the following code:

1222 ; Populate listview
1223 Func _Populate_List()
1224     For $i = 1 To $aArray[0][0]
1225         GUICtrlCreateListViewItem($aArray[$i][1], $Listview)
1226     Next
1227 EndFunc   ;==>_Populate_List

Once populated, the script user can drag and drop listview items to a different position or simply sort them ascending or descending, and of course write the new arrangement back to the INI file section. This works fine on my Windows 7 laptop, but Windows 10 users have report that the drag and drop feature doesn't work as planned.

Trying to solve the problem I borrowed a Windows 10 laptop to test the script and it simply didn't work at all! AutoIt (not my code) displays an error message:

Quote

 

    "Line 1224 (File "E:\Script.exe"):
    
    "Error: Subscript used on non-accesible variable."

 

 

 

The line 1224 is start of the For/Next loop (see above).

Long story short, I have a nicely functional script on Windows 7 (and probably on other Windows previous versions), a partially functional script on some Windows 10 users, and a completely non-functional script on two Windows 10 (a desktop and a laptop) where I had the opportunity to test the script executable.

I'm most likely the culprit here so I'm counting on your valuable hints. TIA.

Edited by Euler G.

Best,
Euler

Link to comment
Share on other sites

  • Developers

Stabs without the script source and more details:

Better error checking to ensure the IniReadSection() function actually worked?
Better checking whether $aArray exists and is actually an array?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thanks for your reply, Jos.

Yes, both error checking and array existence were handled properly. Unfortunately I can't post the whole code here.

Anyway, I found a workaround and this problem was sorted. Instead of using $aArray[0][0] which carries the number of array contents I used UBound($aArray) -1, and that worked fine on Windows 10, though I can't find a reason why it did not in the first construction that sounds more logical to use. Below is how it is now:

; Populate listview
Func _Populate_List()
    ; Enumerate through the array displaying the keys and their respective values.
    For $i = 1 To UBound($aArray) - 1
        GUICtrlCreateListViewItem($aArray[$i][1], $Listview)
    Next
EndFunc   ;==>_Populate_List

I'm still waiting for an user answer about his particular case where the first code worked partially, and if this new construction solved his problem. The error occurred either when referencing $aArray[0][0] (like in the For...Next loop or on attribution ($nCount = $aArray[0][0]) but only when $aArray[0][0] (a global array) was referenced in a function, not in the main code.

Best,
Euler

Link to comment
Share on other sites

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