Jump to content

MaximusCZ

Active Members
  • Posts

    73
  • Joined

  • Last visited

Everything posted by MaximusCZ

  1. Oh my god, now that wouldn't occur to me in a long while, that must be it. Funny how at least one, search term or array element, must be Number, but not both. Ah, then I guess it's just not consistent with other functions that default to -1, but I am okay with that. Thank you both! Edit: Yes, specifying the $time to Number($time) started returning search results OK!
  2. Can someone explain why is the 96 not found? Says Error code 2, which is value outside of array min/max, but clearly is not. Column 0 is sorted, ideally I want to ignore all other columns, but the default values for optional parameters for _ArrayBinarySearch is 0. I think this should be "-1", because I dont want to search every column when specifying 0 in $iColumn. I want to ONLY search column 0, but I guess setting Column 0 just makes it search every column instead?
  3. Because it isnt 2D array, but an array of arrays. just $var[$i][$o] doesnt work here Works perfectly, thanks!
  4. I read a file into array of arrays Local $programFileArray _FileReadToArray($programFile, $programFileArray, "2", ',') Because its array of arrays, I read it like Dim $pointsToAdjust[0] For $i = 0 To UBound($programFileArray)-1 If UBound($programFileArray[$i]) < 5 Then ContinueLoop ;I dont care lines with less than 5 elements If (StringInStr(($programFileArray[$i])[0], $pointName & " : POINT")) == 0 Then ContinueLoop ;not the line we look for Else _ArrayAdd($pointsToAdjust, $i) ;Add the index of an element to the list to remember ExitLoop EndIf Next Now I wanna edit the array so I can call "_FileWriteFromArray" later with my modified data. I check the value I wanna edit: For $point in $pointsToAdjust $testprogramFileArray = $programFileArray ;So the changes here dont affect next iteration ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : ($testprogramFileArray[$point])[7] = ' & ($testprogramFileArray[$point])[7] + 2 & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console <<-- This reads value and adds 2 to it correctly in console output ($testprogramFileArray[$point])[7] = ($testprogramFileArray[$point])[7] + 2 ;<<-- This fails Next It fails with "C:\__work\AutoitSkripts\__PointMouse_fastSim.au3"(1357,78) : error: Statement cannot be just an expression. ($testprogramFileArray[$point])[7] = ($testprogramFileArray[$point])[7] + 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\__work\AutoitSkripts\__PointMouse_fastSim.au3 - 1 error(s), 0 warning(s) Why exactly? The value inside I can read, why cant I assign it a new value? (The +2 is just illustrative) How would I go about updating that value so I can _FileWriteFromArray Later? Thanks for any help
  5. Sure thing! I am reading files containing movement/application programs for atomotive industrial paintshop robots. Each file consists of points and triggers. Points for actual robot movement, and triggers for events like opening/closing the main needle (GunOn/Off), changing application parameters (flow amount of color/air etc) and possibly much more. In this case the IFs are for panel repairs, making the robot paint only the areas that are marked by the factory to be repainted, hence the GunOn/Off events in IFs. The problem I am facing is that if those conditions are made the easy way, theres a high chance a robot will encounter two GunOns in a row (without GunOff in between), and for some stupid reason this raises an alarm. So every condition must be carefully crafted to only trigger precisely as needed, making sure that all condition states from before are considered. Its clunky, its unintuitive, but its reality. I am writing a macro capable of reading these programs, simulating "going trough" the program in sequence for all possible combinations of variables (usually less than 5 in a single module), and making sure such things cant happen. No need to worry, I am not writing a game bot, I am aware of the rules Thanks for taking care of AutoIt and its users so consistently over the years, its really helping. Also 69th comment, nice..
  6. Absolutely amazing, thanks! Had no idea about Execute and Assign function existing at all , now it make sense why you made them Bold in your original post
  7. Already have 1. and 2. finished. I am not sure I follow the rest? Currently I store the vars in an array (KV, MH..), do I just do a pass on the array adding "$" in front of every element? How am I supposed to simulate the boolean logic on the whole statement?
  8. I am not really looking for efficient way to do it, as I said I think bruteforcing is completely acceptable approach here. I just do a pass on the file for each combination of inputs. The issue I have is "how" to parse and store the data in codeblock, so that it can then simulate executing the IF properly.
  9. Hi. I have a file that contains boolean expressions: ... IF  ((KV = TRUE) AND (MH = FALSE)) OR (TV = TRUE) THEN     GUN(GUN1, GunOn, PT5, TR5)   END_IF  ... I would like to read the file, parse those imporant bits, and save those in some data structure that allows me to "simulate a run" trough that file with all combinations of variables. I have trouble comming up with an idea on how to save the data in a way I can than use later. How do I model my data structure so that I can then assign "random" values(true/false) to vars (KV, MH..), and see if, given those variable values, the IF condition is satisfied or not (so whether Gun line gets read given set of variables). Theres gonna be max 10 IFs per file, and the maximum amount of variables is about 10, so bruteforcing seems like the easiest way (I will just try all combinations one after another) for simulation. But how do I code up the "solver" of these regular expressions?
  10. It would be splendid if OP included some screenshots
  11. @junkew Yes, I tried MSAA (not even sure what that is). The other option resulted in target program crashing often. Not sure how to handle WM_GETOBJECT, I dont understand the parameters I should pass. @jugador It works as long as my mouse is actually on the button. Once its not on the button, the button only flickers as if hovered on for the duration of the click (not visible in your script, but visible with "Sleep(100)" added inbetween LBUTTONDOWN and LBUTTONUP. Your script should work elsewhere, its just my application thats special. @Zedna I am not sure I am using Winspector correctly? I open it up along with my target program, drag the crosshair over control of interest and it shows me the control in tree, Thats where my luck ends: When I select "Watch this window class", it asks me what to look for (I select all), and nothing happens. When I open "Messages", the window is always empty. When I open "Properties", it shows properties of window (and clicking refresh works, so dragging the window and pressing refresh updates its position in Properties) but Messages is still empty. I made sure its unpaused. Ran winspector as administrator.
  12. @junkew Sadly the buttonCount variable is empty after calling the DLL. I added $TB_BUTTONCOUNT value of 0x0418 to WindowsConstants.au3. Isnt the GETITEMRECT basically the same way all those spy tools getting their own data about controls? Also since the buttons were not really visible until now, I have a bad feeling those buttons might be custom coded instead of using stubs like "toolbar" windows would expect.. @ad777 Works to the same effect as my gif in very first post. The button is showing itself being hovered over for 100ms and then not for another 100ms. Moving my mouse over it makes it click as needed, but once the mouse leaves the button, it goes back to the hovering effect. @Danyfirex While giving you the installation package would probably be fine, the app needs a hardware bound licencekey and backup of data to load correctly, for which I could get into big trouble if shared. The closest I can get you to it would be remote desktop - is teamviewer ok?
  13. Fiddled a bit with Deviare Managed to catch an event when clicking on two buttons marked in red. Left and Right button in red are mutually exclusive - selecting one deselects the other. Left button button fires the event as shown and right button fires identical one but with "uCheck 0x8" Some of following buttons are just regular buttons like "reset camera"(the house one) and those are not catched. The buttons im interested are in subwindow thats not shown here, also acting as regular buttons (more than one can be selected at once) and are also not catched in this hook. From time to time my hooked application crashes. After restart, this CheckMenuItem still works (on those two buttons only) The HMENU - hMenu - value changed, but UINT - uIDCheckItem and UINT - uCheck values are the same also noteworthy that the event is fired even when using a hotkey (default in program, one of few) to switch between those two items BUT theres also a button that swaps orthographic/perspective camera (single button that changes on click, the "cube" on the right on screenshot), and clicking this button fires Two events, identical to the one shown in picture, first with 0x0 and second with 0x8 as their "uCheck" value. The resulting events from single click on "change perspective" button are identical to two clicks on "select cursor" and "select drag"... 😕
  14. Thanks for suggestion, altho from a quick scan it looks way above my ability. If anyone with knowhow and a idea of how to capture and replicate the event feels like trying, we could arrange some cooperation. This is the screen of process exe in Deviare In the meantime, if anyone has other ideas, please share.
  15. Oh yes. I was trying to find a way to interface with the window in a more controlled way. Over the years I tried saving bmps of buttons of interest, which breaks down once resolution/scaling changes. I tried going pixel-by-pixel to look for different color indicating window delimeter, and hardcoding a path to arrive at the button, but that broke in more ways I can remember. In the end, window/control relative coordinates with commands to set focus to certain controls (to make sure my target is actually visible), proved to be the most robust, but even that I have to manually adapt every once in a while. + I was hoping the macro do certain tasks in background, having to have a window on screen and highjacking mouse kinda sucks. Any ideas on how to control this without pointing real mouse cursor over it is highly appreciated
  16. I tried UI Automation events, and ran both MTWEvents and UIAEHEvents. The MTW records me opening menus to get into my window of interest, but not any changes inside of it. I ran UIAEHEvents with all windows, all event handlers, event IDs and Property IDs selected. Tried separately for every Windows version option under "Options" menu. It is giving me a lot of information when changing focus and playing with the dropdown, but not a single message is fired when I mousehover/mouseclick on any button of interest.. The program still responds by showing the button is hovered and can be clicked to toggle, but UIAEHEvents reports back nothing. Regarding Find BMP in another BMP: I have no trouble finding the button, its always in the same position relative to "Simulation Diagram" window, and while hardcoding the click coordinates isnt ideal, I would argue its okay for my usecase. The issue lies in my unability to click the button without moving mouse cursor there..
  17. @InnI Sadly, works exactly the same as all the tries above. Works fine when actual mouse is over the button, but not when mouse is elsewhere @junkew I am clicking the button trough window-relative coordinates already, the button is at the same place everytime, so thats not the issue. Could you elaborate on catching tooltip event? When I tried the inspect.exe, I can get it to draw rectangles (and provide info) for when I click different areas of the window (like the drop down, slider, graph area). But clicking the buttons of interest it doesnt redraw the rectangle at all, giving me this info: (notice its found by mousemove, not mouseclick, even when I try clicking..)
  18. Thanks for pointer. I tried to identify the object with given tools: Simplespy: (or IUIautomation) The CTRL+W action on a button of interest highlights the control of the entire bar the button is part of, same as default AU3info.exe (shown in pic 1) The output can be seen in spoiler under, when trying to highlight/setfocus oP3, 4 or 5 the whole application crashes. I dont think its targeting the control in more speccific way compared to AU3info anyways. CV: Again, focuses the whole bar, doesnt recognize the buttons themselves. The control info shows basically the same info as AU3info Showing/hiding the individual controls, theres one that hides/shows the whole bar, but none to handle it with more granularity UIASpy: Again, captures the control of the bar, doesnt show any more childrens The whole output here: JavaUI gives me error of Java not installed, but I would bet my socks that java isnt what this program is written in anyway
  19. Hello all. I have a window "Simulation diagram", (that is subwindow of main program). I succesfully open the drop down and select line I need: ControlCommand("Simulation diagram", "", "ComboBox1", "ShowDropDown") $hWnd = WinGetHandle("[CLASS:ComboLBox]") _WinAPI_PostMessage($hWnd, $WM_MOUSEMOVE, 0, _MakeLong(10, 60)) _WinAPI_PostMessage($hWnd, $WM_LBUTTONDOWN, 0, _MakeLong(10, 60)) ;Click Acceleration - absolute _WinAPI_PostMessage($hWnd, $WM_LBUTTONUP, 0, _MakeLong(10, 60)) ;Click Acceleration - absolute That works. But then I need to click the small button A1 next to the drop down. When I do $hWnd = ControlGetHandle("Simulation diagram", "", "ABSActiveBarDockWnd1") _WinAPI_PostMessage($hWnd, $WM_MOUSEMOVE, 0, _MakeLong(295, 19)) I can see the button indicates a mouse is over it But clicking doesnt work.. Unless, I actually move my real mouse over it! while 1 _WinAPI_PostMessage($hWnd, $WM_LBUTTONDOWN, 0, _MakeLong(295, 19)) ; Sleep(50) _WinAPI_PostMessage($hWnd, $WM_LBUTTONUP, 0, _MakeLong(295, 19)) ; Sleep(500) WEnd When I let it run, but position the mouse NOT on "A1" button, I can see the button being hovered for 50ms (changes to half sec hover when I change sleep 50 to 500), but it never gets clicked. If I, while the loop is running, move the mouse over the button, it gets clicked every half a second, as it should. But I need the actual clicking to occur even when I am not actually mouse hovering over the button... I tried to add MOUSEMOVE message above, MOUSEHOVER above, neither helps, even if I play with sleeps (or delete them). Anyone got any idea why the click gets trough only when I actually hover over the button, but fails when I am not hovering the button? (even after I send "MOUSEHOVER" right before clicking).. When I change "L"Button to "R"Button, the menu opens and closes at the real mouse coordinate, not where the PostMessage is specifying. This works exactly the same. Works when mouse is over it, not when mouse is elsewhere.. ControlClick("Simulation diagram", "", "ABSActiveBarDockWnd1", "left", 1, 295, 19) For completeness: Func _MakeLong($LoWord, $HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc ;==>_MakeLong
  20. Hello, Is there a way to reduce colors in bitmap? I would like to make all pixels black, except those that are 100% white. Can you show me direction please?
  21. Oh my god thats such a great idea. Cover all "X" (and perhaps minimize) buttons and force each app to go to taskbar/tray/exit.. Finally not having to set it in each app individual settings and hate those apps that dont offer the choice.
  22. The default PixelGetColor is slow. To speed it up, take a look on those: With this, you can make in memory screenshot and traverse it pixel by pixel muuuch faster than with PixelGetColor. Also works if the window you monitor is in background! or here: or here:
  23. Win 7 Pro version 6.1 (build 7601: SP1) Label is not blinking if $WS_EX_COMPOSITED is set. Label is blinking if $WS_EX_COMPOSITED is not set.
  24. Also using what orbs said, its a great tool. Would be even better if regex werent my nemesis
  25. Hello, Thanks for this script, altho I have an Issue with it. When I try to get HandleCapture working, it succesfully makes screenshot of control on given coordinates IF the window is on top. If I put any other window over it, the screenshot actually contains the overlapping window, blocking the window of interest, and inevitably failing finding the covered piece. Setting "IsUser32" to True just produces black screenshots (of valid resolution tho) no matter if the window is infront or not. Any idea where to point me? Feels to me like it might be problem with windows composition or something. Tried compiling and running as admin, same result. Win7 Pro, transparency of windows turned off I dont really know what I did different now, but setting IsUser32 to True now works.. thanks for cool script!
×
×
  • Create New...