Jump to content

Juggler

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Juggler

  1. Hello! I need to detect when user click on a gui button in 3rd party app. I mean I have to detect event, when user click LMB down on the gui button, then LMB up on the same exact gui button. As you probably know you can click and hold LMB on some element, then move mouse out of it and relase LMB, so it will not fire event. Also, you can push LMB anywhere and move it to the button and then release it, so detecting LMB up is not an option too. I actually need to hook to the gui button pressed event somehow, is that possible? Again, this is not gui I created but a standalone 3rd party app. and it is not always LMB, it could be enter, or space (on some buttons) or even RMB if user switched to left handed mode mouse, for example.
  2. Thank you very much. It is always a little hard to switch programming languages and the way of thinking same algorithms for different languages. I see there will be Chrome JS UDF automation - it could be just great. Now I'm trying to use PixelChecksum - but it doesn't work very well because of different resolutions and fonts and cleartype settings and windows themes etc. There is Sikuli project for such automations - where you have to rely on images anywhere on the screen. Is there UDF like that for autoit? Have a look at demos to get the idea http://sikuli.org/demo.shtml Something like pixelchecksum somewhere on the screen...
  3. ooops - found it - it is called 'variant'
  4. This is awful. Imagine you have complex if like if $res1 and $res2 and ($res3 or $res4) will unfold to many unreadable ifs. But I got the idea. Have you seen mongoDB? It could return: 0 as integer '0' as string 'false' as string false as boolean null - if not defined coz mongodb it is nonsql and nonrelational database and also it can return false if it was an error. that's what I call 'haha' But in simple autoit cases it should be enough to check - if returned result isbool - there was an error, otherwise we got valid result like 'false' string. One more question: If function can return integer, string, boolean how do I define variable to get the result? func tst() if bla bla bla then return number('123') else if bla bla bla return 'string var' else return True ;boolean endif endfunc will it work like this: $res = tst() - first time we got integer later in the code . . . $res = tst() - here we got result as string or it throws an error about datatype mismatch?
  5. What if function could return string 'False' (read from file for example) and boolean false?
  6. Hello! Coming from PHP where function can return false or zero - and zero result is not false result. For example: div (a, b ) { if (b == 0) return false; // we can't use 0 as divider else return a/b; } so when you call ths function you may get 0 or get false - so you can distinguish integer 0 with boolean false if ( div(0, 5) ) - this check will pass ok with zero result and if evaluates to true! if ( div(5, 0) ) - this check will not pass ok, result is not determined and is not returned and if evaluates to false Which is the best way to achieve the same functionality in autoit? I would like to write something like this (simplified version with ommited logic): func read_data() if data_read_ok() then return $data ;data could be 0 too! else return false ;couldn't read data endfunc and use it in the script $result = read_data() ;$result could be 0 if $result = false then msgbox 'we were not able to read data' else msgbox 'we read data' & result ;again result could be 0 - means value read was 0 endif The only way I've found is that you have first to check if returned variable is boolean and then to check if it was false. Like this: if IsBool($result) = True and $result = false then ... But it is too ugly... p.s.: there can be even worse cases - where function can return 0 1 true false (4 separate values) which gives us at least 5 outcomes like this: switch ($result): case 0: ... case 1:... case true: ... case false: ... default: ... - and I can't figure out how to handle it in autoit without loosing code readability...
×
×
  • Create New...