Project

General

Profile

AutoIT ApertureSelection script question

Added by Christopher Lilienthal over 3 years ago

While working to get remote aperture switching working on our microscope I discovered a possible bug in the ApertureSelection.au3 script but before committing a change I wanted to make sure it was not intentional.

In the GetFeiConfigSelections function there is a nested for loop (line 220) that uses the same counting variable as the parent for loop (line 213). Oddly enough the script would work for the objective aperture but not for the consenser_2 or selected_area aperture. I ended up changing the counting variable from i to j in the nested loop as shown in the diff below:

$ diff -Nabur ApertureSelection.au3 ApertureSelection_mod.au3 
--- ApertureSelection.au3    2021-01-14 16:55:28.000000000 -0500
+++ ApertureSelection_mod.au3    2021-01-14 16:56:44.000000000 -0500
@@ -217,9 +217,9 @@

       If StringLower($sKey) == StringLower($key) Then
          Local $aList = StringSplit($aBits[1],",",2)
-         For $i = 0 to UBound($aList)-1
-            $aListNames[$i] = StringStripWS($aList[$i],3); strip leading and trailing white spaces
-            ;MsgBox(0,'config value',$sKey & ' ' & $i & ' ' & $aListNames[$i])
+     For $j = 0 to UBound($aList)-1
+      $aListNames[$j] = StringStripWS($aList[$j],3); strip leading and trailing white spaces
+      ;MsgBox(0,'config value',$sKey & ' ' & $j & ' ' & $aListNames[$j])
          Next
       EndIf
    Next

I do not want to commit this change without running it by someone first as I am not the person who wrote this script and this may have been intentional. Was this intentional?


Replies (2)

RE: AutoIT ApertureSelection script question - Added by Anchi Cheng over 3 years ago

It is not intentional. Go ahead and commit. It is cleaner this way, anyway. Please preserve indentation if possible. I don't think the autoit cares, but would be easier to read.

Thanks.

    (1-2/2)