swoop Posted September 7, 2016 Posted September 7, 2016 (edited) $iStart = _ArraySearch($aArray, $vValue, $iStart, $iEnd, $iCase, $iCompare, 1, $iSubItem, $bRow) If @error Then Return SetError(@error, 0, -1) Local $iIndex = 0, $avResult[UBound($aArray,($bRow ? $UBOUND_COLUMNS : $UBOUND_ROWS))] Do $avResult[$iIndex] = $iStart $iIndex += 1 $iStart = _ArraySearch($aArray, $vValue, $iStart + 1, $iEnd, $iCase, $iCompare, 1, $iSubItem, $bRow) Until @error I get the error when I compile my code, warning: $UBOUND_ROWS: possibly used before declaration. Local $iIndex = 0, $avResult[UBound($aArray,($bRow ? $UBOUND_COLUMNS : $UBOUND_ROWS) error: $UBOUND_ROWS: undeclared global variable. Local $iIndex = 0, $avResult[UBound($aArray,($bRow ? $UBOUND_COLUMNS : $UBOUND_ROWS) The above referenced code snippet is where the Stripped Au3 code fails. But without using the directive: #AutoIt3Wrapper_Run_Au3Stripper=y the code runs fine and is able to compile. What's the best way to debug or diagnose this issue? Edited September 7, 2016 by swoop Hit Return to get new line space, but it submitted topic
Moderators JLogan3o13 Posted September 8, 2016 Moderators Posted September 8, 2016 Declare $UBOUND_ROWS before you try to use it? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
swoop Posted September 8, 2016 Author Posted September 8, 2016 I think I found where in the code this happens: _run_once ("Login.exe") Func _run_once ($process_name) Local $processArray $process_list = ProcessList() $processArray = _ArrayFindAll($process_list, $process_name) $process_sum = UBound($processArray) For $i = $process_sum to 2 Step -1 ProcessClose($process_name) Next EndFunc But I am unsure why using the Stripper should cause an error, but it runs fine without the Stripper. So, when I compile the following with the Stripper turned on, I get the error. However, remove the Stripper directives and the code compiles fine. #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/tl /debug /sf /sv /rsln #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> _run_once ("Login.exe") Func _run_once ($process_name) Local $processArray $process_list = ProcessList() $processArray = _ArrayFindAll($process_list, $process_name) $process_sum = UBound($processArray) For $i = $process_sum to 2 Step -1 ProcessClose($process_name) Next EndFunc
swoop Posted September 8, 2016 Author Posted September 8, 2016 The Ubound error is created when the AutoIt script is compiled while stripped. In the stripped code, this is where it fails: Local $iIndex = 0, $avResult[UBound($aArray,($bRow ? $UBOUND_COLUMNS : $UBOUND_ROWS))] It is generated by the stripper, not the original code in the script. By default the UBound uses $UBOUND_ROWS. I tried to specifically declare it to use $UBOUND_ROWS, but I get the same compile error after compiling it with the stripper: $process_sum = UBound($processArray,1)
Developers Jos Posted September 8, 2016 Developers Posted September 8, 2016 (edited) I can't test at the moment, but could you try the current Beta version of au3stripper to see if the issue persists? Edit: just tested with AU3Check v3.3.15.1 and don;t get any errors on the stripped script with au3check or when ran, so give it a try and in case you still have issues, provide an example I can run giving me an error. Jos Edited September 8, 2016 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.
swoop Posted September 9, 2016 Author Posted September 9, 2016 Hello Jos, I downloaded the latest Beta from https://www.autoitscript.com/site/autoit/downloads/ and still get the error. But the version is 3.3.15.0 for AutoIt Beta. Where do I get 3.3.15.1? When I install the AutoIt 3.3.15.0 Beta, and go to the AutoIt program folder, the AU3Check properties says: 3.3.14.2 Date Modified on 9/18/2015.
Developers Jos Posted September 9, 2016 Developers Posted September 9, 2016 There is real relation to the AutoIt3 version. As stated, post something I can test with as I tried the script you posted but that doesn't trigger ant error for me on the stripped sourcecode. 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.
swoop Posted September 11, 2016 Author Posted September 11, 2016 That's very strange. The code posted fails for me on compile using the Beta. With the same error. I'll try to find another computer to install AutoIt Beta on to try. Not sure if that would make a difference.
PACaleala Posted September 12, 2016 Posted September 12, 2016 Show us the line where $UBOUND_ROWS is declared
BlackLumiere Posted March 13, 2020 Posted March 13, 2020 I had the same issue. In my case I writed like: Local $iMax = UBound($aWindows, $UBOUND_COLUMNS) and I had this error ==> warning: $UBOUND_COLUMNS: possibly used before declaration. Then I just declare it like a Constant, dunno why but it worked and tthe compiler did nnot show the error anymore. Like these: Local Const $iRows = UBound($aArray2D, $UBOUND_ROWS)
Developers Jos Posted March 13, 2020 Developers Posted March 13, 2020 I can only help when sufficient information is provided! This means a testscript that demonstrates the issue. All these loose comments do not mean anything to me and I am terrible at guessing. 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.
BlackLumiere Posted March 13, 2020 Posted March 13, 2020 (edited) I had the same issue. In my case I wrote in a function : Local $iRows = UBound($aWindows, $UBOUND_COLUMNS) ;and I had this error ==> warning: $UBOUND_COLUMNS: possibly used before declaration. Then I just declare the variaable as a Constant, dunno why but it worked, and the compiler did not show error anymore. Like these: Local Const $iRows = UBound($aWindows, $UBOUND_ROWS) Regards! Edited March 13, 2020 by BlackLumiere Bad writted
Developers Jos Posted March 13, 2020 Developers Posted March 13, 2020 ... sure .... just read the post above your last ! 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.
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