Leaderboard
Popular Content
Showing content with the highest reputation on 02/10/2019 in all areas
-
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_IsVisible2 points
-
there was an _Iif (...) function at that time, take a look in Misc1 point
-
Ternary operator wasn't supported on that version of AutoIt.1 point
-
Its OK to run it like that since it wont update any settings permanently To determine if it needs to be toggled back upon exiting the script : $bDock = _IsActive($SPI_GETWINARRANGING) _WinAPI_SystemParametersInfo($SPI_SETWINARRANGING, $bDock) Func _IsActive($iAction) Local Const $bool = DllStructCreate("BOOL") _WinAPI_SystemParametersInfo($iAction, 0, DllStructGetPtr($bool)) Return DllStructGetData($bool, 1) EndFunc ;==>_IsBool Deye1 point
-
temporarily disable with $SPI_SETWINARRANGING set to disabled Procedure .. Deye1 point
-
This seems to work on Win10 but I don't know on Win7: #include <GUIConstants.au3> #include <WinAPI.au3> #include <array.au3> Global $bDock = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "DockMoving") If $bDock Then RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "DockMoving", "REG_SZ", 0) _ArrayDisplay(ScreenAreaSelector()) If $bDock Then RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "DockMoving", "REG_SZ", 1) Func ScreenAreaSelector() ; the color that will be transparent Local $AlphaKey = 0xABCDEF; 0x0000ff00 ; ; create a GUI Local $hGUI = GUICreate('', 50, 50, -1, -1, BitOR($WS_POPUP, $WS_SIZEBOX), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetBkColor($AlphaKey) ; Place an empty Label control on the whole GUI surface (to be used as dragging handle) Local $idLabel = GUICtrlCreateLabel("", 0, 0, 50, 50, -1, $GUI_WS_EX_PARENTDRAG), $hLabel = GUICtrlGetHandle($idLabel) GUICtrlSetResizing($idLabel, $GUI_DOCKBORDERS) ; so the edit control will grow as the window ; change the cursor shape on hovering on the Label control GUICtrlSetCursor($idLabel, 0) ; 0 = hand ; 9 = sizeall ; activate transparency GUICtrlSetBkColor($idLabel, 0xABCDEF) WinSetTrans($hLabel, "", 0x40) _WinAPI_SetLayeredWindowAttributes($hGUI, $AlphaKey, 255, 3) ;change 3 to 4 to get a different GUI style GUISetState(@SW_SHOW, $hGUI) ; wait for a RightClic on the GUI to exit Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN EndSwitch Until False ; calculates the measurements of the selected area Local $aPos1 = WinGetPos($hGUI) #cs (including borders) $aArray[0] = X position $aArray[1] = Y position $aArray[2] = Width $aArray[3] = Height #ce ; Local $aPos2 = WinGetClientSize($hGUI) #cs (only client area) $aArray[0] = Width of window's client area $aArray[1] = Height of window's client area #ce ; thickness of the edges Local $xEdge = ($aPos1[2] - $aPos2[0]) / 2 ; Local $yEdge = ($aPos1[3] - $aPos2[1]) / 2 ; coordinates of the client area $aPos1[0] += $xEdge ; x position $aPos1[1] += $yEdge ; y position $aPos1[2] = $aPos2[0] ; Width of client area $aPos1[3] = $aPos2[1] ; Height of client area GUIDelete($hGUI) Return $aPos1 EndFunc ;==>ScreenAreaSelector Disabling DockMoving doesn't work either.1 point
-
Thanks for being my compass!1 point
-
You should read through the thread you got the color UDF from, page 2 has a post in it that explains how to get around this, ask in that thread how to implement it if you can't figure it out.1 point
-
I will do my very best Next on the list: VCard import Putting everything together into a single UDF (iCal import, VCF import etc.) and rename the thing to OutlookTools.au3. Add timezone support What do you think?1 point
-
I have always felt good with the Mrs. trancexx's UDF, however, alternatively, you could try to embed a BrowserControl in your GUI and use it to display your animated gif. I'm curious, let us know if there are any differences in performance ... Local $hGUI = GUICreate("", 1440, 1080, 0, 0) ; Create a GUI Local $oIE = ObjCreate("Shell.Explorer.2") ; Create a BrowserControl GUICtrlCreateObj($oIE, 0, 0, 1440, 1080) ; Place the BrowserControl on the GUI GUISetState() ;Show GUI ; use this syntax if your gif is on an url $oIE.navigate('https://cdn-learn.adafruit.com/assets/assets/000/058/692/original/3d_printing_cad-animation.gif?1533655361') ; $oIE.navigate('https://media.giphy.com/media/rhWj2qCGOBhiE/giphy.gif') ; use this syntax if you have a local file instead ; $oIE.navigate('file:///' & @ScriptDir & '\MyAnimated.gif') MsgBox(0, 'Pause', "Hit OK end")1 point
-
Advice for Getting Started with Android Development
Xandy reacted to JLogan3o13 for a topic
To get your feet wet with Android automation I would suggest Tasker. It's free, and easy to learn, but capable of a lot.1 point -
If performance is an issue then please check the help file for StdOutRead. The example waits until the process started by Run has ended and then reads StdOut with a single statement. That's as fast as possible1 point
-
I made some changes to the ImageSearch library. You can pass an hBitmap for the image your searching for and the image you want to search in. I also fixed a memory leak i saw. The original post is here You can download it here. Download Thanks, Erk donate always welcome.1 point
-
FileWrite Problem?
JLogan3o13 reacted to faustf for a topic
i think is much better use always handle , thankz again0 points