Jump to content

636C65616E

Active Members
  • Posts

    91
  • Joined

  • Days Won

    1

636C65616E last won the day on August 11 2021

636C65616E had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

636C65616E's Achievements

  1. ok, because I remember writting some kind of parser to remove all my assert before building (this is why as a keyword it should make sense).
  2. okok, do we have an option when building to remove them btw ? (now i remember looking for that in the past). But you're probably true (: Jos could have ended this thread way faster haha (activating the trap card)
  3. hoo, well, yeah in Debug.au3 (forgot that, but true ^^) I was asking if it could fit as a keyword (a native feature).
  4. Also, for instance, when compiling C code : switching from debug to release mode will turn off asserts (completly removing them from the bin, not even compiling them). I mean this is a so common stuff : stands for the reason why i was asking in first instance
  5. dont get why you quoted that (edit: there's no default value to the assertion : the statement must be clear and understood) you can maybe see that as (this is not really the case but for the sake of the metaphore) your anchors points when doing rock climbing : it's a "check point" you assume everything is OK at this step of your climb, you continue and maybe you will fall, the assertion will give you hint why (because those must be true). maybe this is not the best analogy haha
  6. i edited my last message, but a simple proof of concept : (i often use something quite similar in my projects) func assert($check, $msg='', $line=@SCRIPTLINENUMBER) if (not $check) then ConsoleWriteError('[assertion failed @' & $line & '] ' & $smg) Exit endif endfunc func compare_ages($age1,$age2) assert($age1 > 0) assert($age2 > 0) ; do stuff endfunc
  7. will be a part of ... (as you crash the programm) you can kinda argue the same for any other langage implementing it (you can exit, you can handle error, even exception, etc) but the use of assert itself is not questionnable. The purpose of an assert is not to handle error nor return exit code, but to keep track (when you dev) of assertions (stuff that must be true), otherwise the error causing the malfunction is mainly a problem relative to you not understanding what's really going on, or to malfunction in some cases. for instance: a square have 4 sides of equal length imagine you code a programm handling some quadrilateral and you *except* it to be a square, then it *must* (this is an assertion) have 4 sides of equal length, if not the problem is not about handling an error : it is about the purpose of your program itself and how it is used in the end or where this given quadrilateral come from assertion != error handling assertions should disappear when you release/deploy your programm it is a fast forward way to code when you expect the behavior of your programm, in some sense it follows some kind of TDD pattern : run => fail => correct => continue when handling distances you must admit those quantities are positives a segfault could be a 'legit' ("inverse")assertion (you must have allocated and have access to the memory) when dividing you must assert the divisor is non null i hope i was clear, ofc those 2 last example are a bit edgies (some langage handle them, some dont) the use of assert is more "conceptual" than "practical" it can also fall, in some case, on assuming the succes of uncontrollable events (as for memory allocation : the OS not beeing able to allocate the memory, most of the time you will have no control on the 'why' it happens if it is done correctly, and you should probably assert the OS will always be able to allocate)
  8. @Jos ty for moving A simple use case : crash the program with appropriate exit code and flush to stderr some error handling msg I usually use an udf to do it in all my projects, so i mainly ask because it is just about redundancy ^^ (i mean you have this kind of native feature in nearly all scripting langages i can think about). I was wondering if it would be a good idea, as it is something so commoly used and "basic" in some sense when in dev mod (ofc you will probably handle errors in an other way when u go to deployment), so asking just for the sake of asking ( i'm an innocent and naive beeing (: ).
  9. Hey there, Long time since the last time i came around hehe, had to work on some project using AutoIt recently ... so here i am again Here's something i was a bit confused about since a long time : why not adding a simple assert function to the langage ? (many langages already include this as a native feature ). cheers nb: i checked quickly if there was already a topic about that, without success (so soz for the dup topic if it is the case)
  10. Hey, First : you should do some error checking, eg read the help files and check after each step if everything is ok, for instance : func assert($check, $msg, $line=@SCRIPTLINENUMBER) if (not $check) then MsgBox(0x10,'ERROR','Assert failed at line ' & $line & @CRLF & $msg) Exit endif endfunc local $res = WinActivate("Excavator") ; from the doc : WinActivate success return the value 0 assert($res = 0, 'WinActivate failed') Then proceed step by step. A guess why it doesnt work : you cannot simply use the window title, you maybe need to use the window handle (idk maybe). A tool to help you with the windows title/class/etc : AU3Info. As mentionned many time here: sending keystroke is usually a bad idea, however for the specific case of consoles it is not that simple to retrieve text buffer (it is doable but a bit tedious by working around the windows console api), so i guess it is a more "simple" solution to proceed as you do
  11. The real question is "why" I'm sorry but this kind of posts always triggers me ... for many reasons : 1. if we know what you want to achieve i can bet there's better way to handle the problem than sending inputs, 2. it always looks sus (about some not-so-legal-and-authorized-here automation) anyway as statted before : if the window is not active it will not work this way.
  12. 636C65616E

    Python Code

    Also many people use Spyder. My personnal preference are (as for nearly any langage) : Sublime Text and a good old console, anyway sometimes I may use VS Code (there's a quite good module for ipynb files and google colab support). But especially for python i really pref using a console for the sake of managing my envs
  13. Hey, not bumping this but wanted to point something ^^ For people familiar with parametric testing, i could bet there's no significative difference of means ... Long story short => the avg time for a call might not be different depending on the method (for a statistician pov) (a cue : std dev shas same magnitude than means O.O) NOTE: there's lot of stuff going on about 'opening' dll etc. You want to load the library in the adress space, reference and import the exported symbols, looking for one specific etc. But, for your information, kernel32, user32, crt, and many more are already loaded by the autoit interpreter (suprised ?? xD). If you really want to 'optimize' your code when calling those libs, you should know: they are *ALWAYS* loaded on the same range (and i'm not talking about autoit here), so you could just fetch one time the adress of w/e you want and then use a dllcalladress ... but for some, not so stupid, reasons : this is overkill and not that smart to do so (also makes your code quite unreadable) for the sake of some microseconds optimisation.
  14. PixelSearch will search based on what is rendered (basically, what is visible on your screen). A minimized window isn't rendered ...
  15. Hey, Dunno how you're confident with msdn, windows native stuff, etc and maybe about programming itself ... But to make it simple (and i don't get why you asked that for so i just gonna explain how it works without example (don't have time to check the pasted code you provided, and mainly this kind of stuff is usually used for some sus application)). So in one line : You can't close the mutex itself. You have to duplicate it and free the copy : windows "kills" the original handle when you free the dup handle. /Regards NB: maybe this is not what you're trying to accomplish, but it's hard to understand your goal: openning infinite instances of a program limited by a mutex (that's what i explained) ? opening, killing then reopening a same program an infinite number of time ?
×
×
  • Create New...