Jump to content

Au3 Stripper Issues


swoop
 Share

Recommended Posts

$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 by swoop
Hit Return to get new line space, but it submitted topic
Link to comment
Share on other sites

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

 

 

 

 

Link to comment
Share on other sites

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)

 

Link to comment
Share on other sites

  • Developers

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

  • Developers

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

Link to comment
Share on other sites

  • 3 years later...

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

  • Developers

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

Link to comment
Share on other sites

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 by BlackLumiere
Bad writted
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...