Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/09/2019 in all areas

  1. KaFu

    _hWnd_IsVisible

    Test if a Window or control is visible and not covered by other windows or controls. Maybe useful to someone: ; Inspired by https://stackoverflow.com/questions/5445889/get-which-process-window-is-actually-visible-in-c-sharp ; GW_HWNDPREV always returned window "Default IDM" on my system, so I had to take a different approach #include <GUIConstantsEx.au3> #include <WinAPISysWin.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> Local $hGui = GUICreate("_hWnd_IsVisible", 180, 180) Local $c_label = GUICtrlCreateLabel("test-1", 30, 30, 100, 100) Local $hWnd_label = GUICtrlGetHandle($c_label) GUICtrlSetBkColor(-1, 0x00ff00) GUICtrlCreateLabel("test-2", 50, 50, 100, 100) GUICtrlSetBkColor(-1, 0x00ffff) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch ConsoleWrite(TimerInit() & @TAB & "Gui=" & _hWnd_IsVisible($hGui) & @CRLF) Opt("WinSearchChildren", 1) ConsoleWrite(TimerInit() & @TAB & "Control=" & _hWnd_IsVisible($hWnd_label, $hGui) & @CRLF) Opt("WinSearchChildren", 0) WEnd Func _hWnd_IsVisible($hWnd, $hWnd_ParentGui = 0) Local $tRect_hWnd = _WinAPI_GetWindowRect($hWnd) Local $h_Rgn_hWnd = _WinAPI_CreateRectRgn(DllStructGetData($tRect_hWnd, 1), DllStructGetData($tRect_hWnd, 2), DllStructGetData($tRect_hWnd, 3), DllStructGetData($tRect_hWnd, 4)) Local $tRect_hWndPrev, $h_Rgn_hWndPrev Local $aList = WinList() For $i = 1 To $aList[0][0] If $aList[$i][1] = $hWnd Then ExitLoop If BitAND(WinGetState($aList[$i][1]), 2) And $aList[$i][1] <> $hWnd_ParentGui Then $tRect_hWndPrev = _WinAPI_GetWindowRect($aList[$i][1]) $h_Rgn_hWndPrev = _WinAPI_CreateRectRgn(DllStructGetData($tRect_hWndPrev, 1), DllStructGetData($tRect_hWndPrev, 2), DllStructGetData($tRect_hWndPrev, 3), DllStructGetData($tRect_hWndPrev, 4)) _WinAPI_CombineRgn($h_Rgn_hWnd, $h_Rgn_hWnd, $h_Rgn_hWndPrev, $RGN_DIFF) _WinAPI_DeleteObject($h_Rgn_hWndPrev) EndIf Next Local $iRes = _WinAPI_GetRgnBox($h_Rgn_hWnd, $tRect_hWnd) _WinAPI_DeleteObject($h_Rgn_hWnd) Switch $iRes Case 1 ; $NULLREGION Return 0 Case 2 ; $SIMPLEREGION Return 1 Case 3 ; $COMPLEXREGION Return 1 Case Else ; 0 = Error Return -1 EndSwitch EndFunc ;==>_hWnd_IsVisible
    2 points
  2. Sers, while working on another project I was in need of desktop notifications. I wanted an own implementation and from time to time the code grew and I thought about sharing it with the world. I know that there is a similar UDF out there but when my project got bigger an UDF was the best choice for me. As you can see the UDF's differ in usage and style of notifications. So, what do we have? The UDF offers the usage of permanent desktop notifications for your own script in a very easy way. Notifications are starting in the bottom right corner of your main screen and will be shown on top until there is no more space. Further notifications will be shown if previous ones are closed. The notifications have a nice minimalistic design in two colors. By default they match the look of the dark taskbar in Windows 10, but colors and other things can be set differently if wished (see example scripts). The UDF works for GUIOnEventMode activated and deactivated and detects it automatically. Show me! Each notification has its GUI, a title, the message, a seperating line, date label, time label and a closing button (and if activated, a border around the notification). The color of the title, message, seperating line, date, time and closing button (+ border if activated) have all the text color. Right now notifications have a fixed size. I thought about variable sizes but did not add it because I didn't need it so far. Some people may notice the shorter seperating line when border is activated, thats just because of better looks Notifications will be colored as the following: Windows 10: they match the design of the taskbar Windows 8/8.1: On most designs: they match the border color of active windows, else they are black with transparency (see screenshot) Windows 7 and earlier: black with transparency (sry aero) How do I use notifications in my script? include UDF call _Notifications_Startup() (after you determined if you want to use GUIOnEventMode or not) If GUIOneventMode deactivated: call _Notifications_CheckGUIMsg($__GUIMsg) in your main loop create a notification using _Notifications_Create($__title, $__message) Between step 2 and 3 you can set various options: _Notifications_SetAnimationTime _Notifications_SetBorder _Notifications_SetButtonText _Notifications_SetBkColor _Notifications_SetColor _Notifications_SetDateFormat _Notifications_SetSound _Notifications_SetTextAlign _Notifications_SetTimeFormat _Notifications_SetTransparency You can also set own functions to be called when notifications are clicked (see advanced example). And now? You can find more information in the UDF. There also are two example scripts to show the usage for GUIOnEventMode activated and deactivated. Another advanced example shows the usage of the Set-Functions. Thats it? Yup, have fun. Changelog Notifications.au3 ( v1.2) Notifications GUIMsg Example.au3 Notifications OnEvent Example.au3 Notifications Advanced Example.au3
    1 point
  3. maybe the server that provides the web page checks the browser you are using to decide whether or not to send the source. If you say that with IE.au3 it works, then you could try using the HttpSetUserAgent ('' Mozilla / 5.0 '') command right away before using the InetGet () or InetRead () functions ...
    1 point
  4. You are using the wrong values. Try this -- #include <IE.au3> Global $oIE = _IECreate("http://select2.github.io/select2/", 1) Local $jQuery = _jQuerify($oIE) $jQuery('#s2id_e3').select2("val", "OR", "triggerChange", true) Sleep(1000) $jQuery('#s2id_e3').select2("val", "FL", "triggerChange", true) Sleep(1000) $jQuery('#s2id_e3').select2("val", "TN", "triggerChange", true)
    1 point
  5. Have you tried either of the following? -- $jQuery('#s2id_company_id').select2("val", "16013").trigger('changed') $jQuery('#s2id_company_id').select2("val", "16013", "triggerChange", true)
    1 point
  6. #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IE_Create ("http://repl.flexlink.com/os/products.htm?clicktype=A") Local $oInputs = _IETagNameGetCollection($oIE, "a") Local $sTxt = "" For $oInput In $oInputs $sTxt &= $oInput.innerText & @CRLF Next MsgBox($MB_SYSTEMMODAL, "Tag A", $sTxt) _IEQuit($oIE) To start you. It should display all the products. $oInput are objects in the collection. You can do whatever you want with object.
    1 point
  7. ProgAndy

    AutoItObject UDF

    Thanks, but monoceres, trancexx nad Kip have done much work, too.
    1 point
×
×
  • Create New...