IUtilizeScripts 0 Posted April 21, 2014 (edited) Hello, I'm having difficulty understanding how to evaluate as String as a Boolean expression in an IF statement. Will one of you please assist me in accomplishing this? Here is the code I have so far: #include <Array.au3> Local $aTest[5] = [1,2,3,4,5] Local $iLimit = 3 Local $sCriteria = "$avArray[$i] >" & $iLimit _ArrayDisplay($aTest) $aTest = CondenseArray($aTest, $sCriteria) _ArrayDisplay($aTest) Func CondenseArray($avArray, $sCriteria) Local $Keep[UBound($avArray)] Local $HitNo = 0 For $i = 0 to Ubound($avArray) - 1 Step 1 If $sCriteria Then $Keep[$HitNo] = $i $HitNo = $HitNo + 1 EndIf Next ReDim $Keep[$HitNo] Local $avRevisedArray[UBound($Keep)] If UBound($avArray, 0) = 1 Then For $row = 0 to Ubound($Keep, 1) - 1 $avRevisedArray[$row] = $avArray[$Keep[$row]] Next EndIf Return $avRevisedArray EndFunc Thank you. Edited April 21, 2014 by IUtilizeScripts Share this post Link to post Share on other sites
FireFox 260 Posted April 21, 2014 Hi, You're talking about evaluation, but I don't see the Eval function anywhere. Br, FireFox. OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDFMy Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme makerMy Examples : Capture tool | IP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewerMy Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control Share this post Link to post Share on other sites
IUtilizeScripts 0 Posted April 21, 2014 (edited) Hi, You're talking about evaluation, but I don't see the Eval function anywhere. Br, FireFox. Thanks for the help! I didn't know that the Eval or Execute functions existed. The solution was the Execute function: #include <Array.au3> Local $aTest[5] = [1,2,3,4,5] Local $iLimit = 3 Local $sCriteria = "$avArray[$i] >" & $iLimit _ArrayDisplay($aTest) $aTest = CondenseArray($aTest, $sCriteria) _ArrayDisplay($aTest) Func CondenseArray($avArray, $sCriteria) Local $Keep[UBound($avArray)] Local $HitNo = 0 For $i = 0 to Ubound($avArray) - 1 Step 1 If Execute($sCriteria) Then $Keep[$HitNo] = $i $HitNo = $HitNo + 1 EndIf Next ReDim $Keep[$HitNo] Local $avRevisedArray[UBound($Keep)] If UBound($avArray, 0) = 1 Then For $row = 0 to Ubound($Keep, 1) - 1 $avRevisedArray[$row] = $avArray[$Keep[$row]] Next EndIf Return $avRevisedArray EndFunc Edited April 21, 2014 by IUtilizeScripts Share this post Link to post Share on other sites
FireFox 260 Posted April 21, 2014 Right OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDFMy Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme makerMy Examples : Capture tool | IP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewerMy Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control Share this post Link to post Share on other sites