dersiniar Posted March 10, 2022 Posted March 10, 2022 i started new script today, and something wierd happend. If Not @Error Then not working For $b = 1 to $aFile[0] $sTemp = _StringBetween($aFile[$b], $PriceStart, $PriceEnd) If $sTemp <> 0 Then _ArrayAdd($aFinal, $sTemp[0]) Next Local $Price = $aFinal[1] If Not @error Then Sleep(100) Else Local $Price = "0" EndIf If i remove error test, i get results as neede, but as soon i but this error test in, i get only "Else" outbut from error
Developers Jos Posted March 10, 2022 Developers Posted March 10, 2022 (edited) What is the If @Error supposed the check? @Error contains the Error code of the last performed function! Also format your code to make it better readable (with Tidy): For $b = 1 To $aFile[0] $sTemp = _StringBetween($aFile[$b], $PriceStart, $PriceEnd) If $sTemp <> 0 Then _ArrayAdd($aFinal, $sTemp[0]) Next Local $Price = $aFinal[1] If Not @error Then Sleep(100) Else Local $Price = "0" EndIf Edited March 10, 2022 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.
dersiniar Posted March 11, 2022 Author Posted March 11, 2022 11 hours ago, Jos said: Local $Price = $aFinal[1] it have to error check this one. Or rather if it fails for some reason, then just skip. Cos sometimes $aFinal[1] can be 0 value. I have tried different ways, but result is same. i always get output for Local $Price = "0", but if i delete this part If Not @error Then Sleep(100) Else Local $Price = "0" EndIf Then all works good until 0 value appears
Solution dersiniar Posted March 11, 2022 Author Solution Posted March 11, 2022 (edited) 12 hours ago, Jos said: What is the If @Error supposed the check? @Error contains the Error code of the last performed function! Also format your code to make it better readable (with Tidy): For $b = 1 To $aFile[0] $sTemp = _StringBetween($aFile[$b], $PriceStart, $PriceEnd) If $sTemp <> 0 Then _ArrayAdd($aFinal, $sTemp[0]) Next Local $Price = $aFinal[1] If Not @error Then Sleep(100) Else Local $Price = "0" EndIf What i need, figured out If this Global $Price = $aFinal[1] fails then i need to use Global $Price = $aFinal[0] Edited March 11, 2022 by dersiniar
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