argumentum Posted March 12, 2021 Posted March 12, 2021 1 hour ago, Shark007 said: This is some damn nice code too yes but try with the wrong URL and watch it crash #include <Constants.au3> #include <InetConstants.au3> Exit MsgBox($MB_SYSTEMMODAL, "", Example8("https://shark007.net/build.lo_g")) Func Example8($sURL) Local $s = BinaryToString(InetRead($sURL, $INET_FORCERELOAD)) If Not StringLen($s) Then Return SetError(1, 1, "no data") Local $a = StringRegExp($s, "Version: ([^\v]*)", 1) If @error Then Return SetError(@error, 2, "not found") Return StringReplace(StringLeft($a[0], StringInStr($a[0], "-", 0, -1)-1), "-", ".") EndFunc ;==>Example Checking each step has it's merits. Coding to one's level of understanding is better for debugging than magical stuff. ( Clarification: I'd love to understand RegExp but If I don't, I'll have to dumb it down a bit ) Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Shark007 Posted March 12, 2021 Author Posted March 12, 2021 (edited) 2 hours ago, argumentum said: I love these one-liners. They are streamlined. They look like, wow 😲 Unfortunately there is no room to add an "If @error Then" 🧐 This is exactly why after test these, I went back to using the one in post 6. The one from post 6 does not crash. Edited March 12, 2021 by Shark007
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