Search the Community
Showing results for tags 'screen'.
-
Is there anyway that Autoit can detect a video that has been frozen on screen for a certain time? I have a program that records videos from my surveillance cameras, unfortunately after an update, sometimes the recording and live feed freezes on one of the cameras displayed on screen. The program has to be restarted, so I wrote a script that it restarts the program and then starts recording on each camera, but only if i physically notice that it has been frozen. So it would be great if all this can be done automatically.
-
I am using code to create splash screen. But neither screen is splashing or balls are increasing or moving. It works on one machine (old windows 10 laptop) but not works in other machine. Out of 5 machines, only one is working. Please help #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Memory.au3> #include <GDIPlus.au3> #include <StaticConstants.au3> #include <TrayConstants.au3> Global Const $sExcelColor = "217346", $sWordColor = "2b579a", $sOutlookColor = "B7472A" Global Const $sThemeColor = $sOutlookColor Local Const $PI = 3.141592653589793 Global Const $hDwmApiDll = DllOpen("dwmapi.dll") Global $sChkAero = DllStructCreate("int;") DllCall($hDwmApiDll, "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($sChkAero)) Global $bAero = DllStructGetData($sChkAero, 1) Global $fStep = 0.02 If Not $bAero Then $fStep = 1.25 _GDIPlus_Startup() Global $iW = 442, $iH = 30 $hGUI = GUICreate("Office", $iW, 252, @DesktopWidth / 2.95, @DesktopHeight / 3.2, $WS_POPUP) GUISetBkColor("0x" & $sThemeColor) $Label1 = GUICtrlCreateLabel("SciTE4AutoIt3", 8, 8, 102, 21) GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI Light") GUICtrlSetColor(-1, 0xFFFFFF) $Label2 = GUICtrlCreateLabel("AutoIt 247", 64, 72, 314, 75, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 40, 400, 0, "Segoe UI Light") GUICtrlSetColor(-1, 0xFFFFFF) $Label3 = GUICtrlCreateLabel("Starting...", 10, 205, 54, 21) GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI Light") GUICtrlSetColor(-1, 0xFFFFFF) $Label4 = GUICtrlCreateLabel("r", 410, 4, 20, 21) GUICtrlSetFont(-1, 12, 400, 0, "Webdings") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetTip(-1, "Closes the splash screen.") $Label5 = GUICtrlCreateLabel("0", 385, 0, 20, 21) GUICtrlSetFont(-1, 12, 400, 0, "Webdings") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetTip(-1, "Minimises the splash screen.") GUISetState(@SW_SHOW) Global Const $iPic = GUICtrlCreatePic("", 0, 150, $iW, $iH) GUICtrlSetState(-1, $GUI_DISABLE) WinSetTrans($hGUI, "", 0) GUISetState() Global $hHBmp_BG, $hB, $iSleep = 20 GUIRegisterMsg($WM_TIMER, "PlayAnim") DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iSleep, "int", 0) Global $iballs = 5 Global $aPos[$iballs][3] For $i = 0 To $iballs - 1 $aPos[($iballs - 1) - $i][0] = -10 $aPos[($iballs - 1) - $i][1] = $iH / 2 Next $aPos[0][2] = 1 Global $z, $iPerc For $z = 1 To 255 Step $fStep WinSetTrans($hGUI, "", $z) Next Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Label4 ConsoleWrite("Exit") GUIRegisterMsg($WM_TIMER, "") _WinAPI_DeleteObject($hHBmp_BG) _GDIPlus_Shutdown() For $z = 255 To 1 Step -$fStep WinSetTrans($hGUI, "", $z) Next GUIDelete($hGUI) Exit EndSwitch Until False Func PlayAnim() $hHBmp_BG = _GDIPlus_LinearBalls($iW, $iH, $iPerc, 3, $iballs) $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG) If $hB Then _WinAPI_DeleteObject($hB) _WinAPI_DeleteObject($hHBmp_BG) If $aPos[$iballs - 1][2] = 2 Then For $i = 0 To $iballs - 1 $aPos[$i][0] = -10 $aPos[$i][2] = 0 Next $aPos[0][2] = 1 EndIf EndFunc ;==>PlayAnim Func _GDIPlus_LinearBalls($iW, $iH, $iPerc, $iRadius = 5, $iballs = 3, $bHBitmap = True) Local Const $iDiameter = $iRadius * 2 Local $tPointF1 = DllStructCreate("float;float") Local $pPointF1 = DllStructGetPtr($tPointF1) Local $tPointF2 = DllStructCreate("float;float") Local $pPointF2 = DllStructGetPtr($tPointF2) DllStructSetData($tPointF1, 1, $iDiameter) DllStructSetData($tPointF1, 2, 0) DllStructSetData($tPointF2, 1, $iDiameter) DllStructSetData($tPointF2, 2, $iDiameter) Local $hBrushBall2 = DllCall($__g_hGDIPDll, "uint", "GdipCreateLineBrush", "ptr", $pPointF1, "ptr", $pPointF2, "uint", 0xFFcecbca, "uint", 0xFFf2eeed, "int", 1, "int*", 0) $hBrushBall2 = $hBrushBall2[6] Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) _GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrushBall1 = _GDIPlus_BrushCreateSolid("0xFF" & $sThemeColor) _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iW, $iH, $hBrushBall1) Local $i, $fDH, $height Local $ixPartScreen = $iW / 16 For $i = 0 To $iballs - 1 Local $iSpeed, $x If $aPos[$i][2] = 1 Then If $aPos[$i][0] < $ixPartScreen * 7 Then $x = $aPos[$i][0] If $x < 0 Then $x = 0 $iSpeed = 5 + (20 * ((($ixPartScreen * 7) - $x) * 100) / ($ixPartScreen * 7)) / 100 ElseIf $aPos[$i][0] > ($ixPartScreen * 9 - ($i * $iRadius * 1.5)) Then $iSpeed = 20 + (60 * ((($aPos[$i][0] - $ixPartScreen * 9)) * 100) / ($ixPartScreen * 9)) / 100 Else $iSpeed = 2 EndIf If $i > 0 And $aPos[$i - 1][0] - ($aPos[$i][0] + $iSpeed) < 13 And $aPos[$i][0] < $ixPartScreen * 9 Then $aPos[$i][0] = $aPos[$i - 1][0] - 13 Else $aPos[$i][0] = $aPos[$i][0] + $iSpeed EndIf EndIf If $i < $iballs - 1 Then If $aPos[$i][0] > $ixPartScreen * 3 Then $aPos[$i + 1][2] = 1 EndIf If $aPos[$i][0] > $iW + $iRadius Then $aPos[$i][2] = 0 If $i = $iballs - 1 Then $aPos[$i][2] = 2 EndIf _GDIPlus_GraphicsFillCircle($hCtxt, $aPos[$i][0], $aPos[$i][1], $iRadius, $hBrushBall2) Next _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hBrushBall1) _GDIPlus_BrushDispose($hBrushBall2) If $bHBitmap Then Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBITMAP EndIf Return $hBitmap EndFunc ;==>_GDIPlus_LinearBalls Func _GDIPlus_GraphicsFillCircle($hCtxt, $iXCenterPos, $iCenterYPos, $iRadius, $hBrush) _GDIPlus_GraphicsFillEllipse($hCtxt, $iXCenterPos - $iRadius, $iCenterYPos - $iRadius, $iRadius * 2, $iRadius * 2, $hBrush) EndFunc ;==>_GDIPlus_GraphicsFillCircle
-
_GDIPlus_MarkScreenRegionAnimated build 2020-08-07 beta
UEZ posted a topic in AutoIt Example Scripts
Here another example to mark the desktop to get the marked region for capturing. This example is not perfect and not very fast (room for improvements). ;Coded by UEZ build 2020-08-07 beta ;Code cleanup up mLipok ; ;Short instruction: mark area on your desktop and press return key to capture. #include <APISysConstants.au3> #include <Array.au3> ;#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> ; enum _PROCESS_DPI_AWARENESS -> https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx Global Enum $DPI_AWARENESS_INVALID = -1, $PROCESS_DPI_UNAWARE = 0, $PROCESS_SYSTEM_DPI_AWARE, $PROCESS_PER_MONITOR_DPI_AWARE ;https://docs.microsoft.com/en-us/windows/desktop/hidpi/dpi-awareness-context Global Enum $Context_UnawareGdiScaled = -5, $Context_PerMonitorAwareV2, $Context_PerMonitorAware, $Context_SystemAware, $Context_Unaware _WinAPI_SetProcessDpiAwarenessContext($Context_PerMonitorAware) Global $__g_hGUI_MarkArea, $__g_hGUI_Bg, $__g_iLabel_TL, $__g_iLabel_TM, $__g_iLabel_TR, $__g_iLabel_LM, $__g_iLabel_RM, $__g_iLabel_BL, $__g_iLabel_BM, _ $__g_iLabel_BR, $__g_iOldCursor, $__g_iW, $__g_iH, $__g_iColor_ResizeDots = 0xFFFFFF, $__g_iBorder = 4, $__g_bSelectionDone = False Global $aRect = _GDIPlus_MarkScreenRegionAnimated() Global $hImage_Capture = _ScreenCapture_Capture(@TempDir & "\Test.png", $aRect[0], $aRect[1], $aRect[0] + $aRect[2] - 1, $aRect[1] + $aRect[3] - 1, False) ShellExecute(@TempDir & "\Test.png") ;_ArrayDisplay($aRect, "Marked area coordinates") Func _GDIPlus_MarkScreenRegionAnimated($bAnim = True) _GDIPlus_Startup() Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hFullScreen) $__g_hGUI_Bg = GUICreate("", $aFullScreen[2], $aFullScreen[3], $aFullScreen[0], $aFullScreen[1], BitOR($WS_CLIPCHILDREN, $WS_POPUP), $WS_EX_TOPMOST) ;to avoid cursor flickering and for proper control read WinSetTrans($__g_hGUI_Bg, "", 0x01) $__g_hGUI_MarkArea = GUICreate("", 1, 1, -1, -1, $bAnim ? $WS_POPUP : BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED), $__g_hGUI_Bg) GUISetBkColor(0xABCDEF, $__g_hGUI_MarkArea) If Not $bAnim Then $__g_iColor_ResizeDots = 0xFF0000 $__g_iLabel_TL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_LM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;left mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_RM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;right mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) GUISetState(@SW_SHOWNA, $__g_hGUI_Bg) GUISetState(@SW_SHOW, $__g_hGUI_MarkArea) $__g_iOldCursor = MouseGetCursor() GUISetCursor(3, 1, $__g_hGUI_Bg) GUISetCursor(3, 1, $__g_hGUI_MarkArea) _WinAPI_SetLayeredWindowAttributes($__g_hGUI_MarkArea, 0xABCDEF, 0xF0) Local $aMPos, $aPrevMPos[2] = [MouseGetPos(0) + 1, MouseGetPos(1) + 1], $iID, $aCI, $iX, $iY, $aOldWinPos, $aOldMPos, $bMoved Local $aGUIStartPos, $iKey_Exit = GUICtrlCreateButton("", $aFullScreen[0] - 10, $aFullScreen[1] - 10, 1, 1), $aAccelKeys[1][2] = [["{ENTER}", $iKey_Exit]] GUISetAccelerators($aAccelKeys, $__g_hGUI_Bg) GUISetAccelerators($aAccelKeys, $__g_hGUI_MarkArea) #forceref $bMoved Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iKey_Exit If $bAnim Then GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", $iID) GUIRegisterMsg($WM_ERASEBKGND, "") EndIf _GDIPlus_Shutdown() Local $aResult = WinGetPos($__g_hGUI_MarkArea) $aResult[2] = WinGetClientSize($__g_hGUI_MarkArea)[0] $aResult[3] = WinGetClientSize($__g_hGUI_MarkArea)[1] GUIDelete($__g_hGUI_MarkArea) GUIDelete($__g_hGUI_Bg) If Not $__g_bSelectionDone Then $aResult = 0 Return $aResult EndSwitch $aMPos = MouseGetPos() If ($aMPos[0] <> $aPrevMPos[0] Or $aMPos[1] <> $aPrevMPos[1]) And (Not $__g_bSelectionDone) Then WinMove($__g_hGUI_MarkArea, "", $aMPos[0], $aMPos[1]) $aPrevMPos = $aMPos EndIf $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) If $aCI[2] And (Not $__g_bSelectionDone) Then $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If $bAnim Then GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND") GUIRegisterMsg($WM_TIMER, "PlayBorderAnim") $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", 1, "uint", 50, "ptr", 0)[0] EndIf While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) $aMPos = MouseGetPos() $__g_iW = Abs($aMPos[0] - $aGUIStartPos[0]) + 1 $__g_iH = Abs($aMPos[1] - $aGUIStartPos[1]) + 1 If $aMPos[0] < $aGUIStartPos[0] Then $iX = $aMPos[0] Else $iX = $aGUIStartPos[0] EndIf If $aMPos[1] < $aGUIStartPos[1] Then $iY = $aMPos[1] Else $iY = $aGUIStartPos[1] EndIf WinMove($__g_hGUI_MarkArea, "", $iX, $iY, $__g_iW, $__g_iH) UpdateCtrlPos($bAnim) WEnd $__g_bSelectionDone = True GUISetCursor(3, 1, $__g_hGUI_MarkArea) ElseIf $aCI[3] And $__g_bSelectionDone Then $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If _WinAPI_PtInRectEx(MouseGetPos(0), MouseGetPos(1), $aGUIStartPos[0], $aGUIStartPos[1], $aGUIStartPos[0] + $aGUIStartPos[2], $aGUIStartPos[1] + $aGUIStartPos[3]) Then $aMPos = MouseGetPos() $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) While $aCI[3] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aGUIStartPos[0] - ($aMPos[0] - MouseGetPos(0)), $aGUIStartPos[1] - ($aMPos[1] - MouseGetPos(1)), $__g_iW, $__g_iH) GUISetCursor(0, 1, $__g_hGUI_Bg) GUISetCursor(0, 1, $__g_hGUI_MarkArea) WEnd GUISetCursor(3, 1, $__g_hGUI_Bg) GUISetCursor(3, 1, $__g_hGUI_MarkArea) EndIf EndIf If $__g_bSelectionDone Then $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) If @error Then ContinueLoop Switch $aCI[4] Case $__g_iLabel_TL GUISetCursor(12, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), MouseGetPos(1), $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BR GUISetCursor(12, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_TR GUISetCursor(10, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BL GUISetCursor(10, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_LM GUISetCursor(13, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3]) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_RM GUISetCursor(13, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3]) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_TM GUISetCursor(11, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2], $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BM GUISetCursor(11, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2], $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case Else GUISetCursor(3, 1, $__g_hGUI_MarkArea) EndSwitch EndIf Until False EndFunc ;==>_GDIPlus_MarkScreenRegionAnimated Func UpdateCtrlPos($bAnim = True) Local Const $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "") $__g_iW = $aGUIStartPos[2] $__g_iH = $aGUIStartPos[3] ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TL, 0, 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TM, ($__g_iW - $__g_iBorder) / 2, 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_LM, 0, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_RM, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BL, 0, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BM, ($__g_iW - $__g_iBorder) / 2, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "PlayBorderAnim") EndFunc ;==>UpdateCtrlPos Func PlayBorderAnim() Local $aWinPos = WinGetClientSize($__g_hGUI_MarkArea), $iW = $aWinPos[0], $iH = $aWinPos[1] Local Static $fOffset = 0 Local Const $iSize = $__g_iBorder / 2 Local Const $hDC = _WinAPI_GetDC($__g_hGUI_MarkArea) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) Local Const $hPen = _GDIPlus_PenCreate(0xFF0178D7, $iSize), $hPen2 = _GDIPlus_PenCreate(0xFFFFFFFF, $iSize), _ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $__g_iColor_ResizeDots), $hPen3 = _GDIPlus_PenCreate(0xFF000000) _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDASHDOT) _GDIPlus_GraphicsClear($hCanvas, 0xFFABCDEF) ;for faster performance direct dll calls DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen2, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2) DllCall($__g_hGDIPDll, "int", "GdipSetPenDashOffset", "handle", $hPen, "float", $fOffset) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) $fOffset += 0.5 _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($__g_hGUI_MarkArea, $hDC) _GDIPlus_PenDispose($hPen) _GDIPlus_PenDispose($hPen2) _GDIPlus_PenDispose($hPen3) _GDIPlus_BrushDispose($hBrush) EndFunc ;==>PlayBorderAnim Func WM_ERASEBKGND($hWnd, $iMsgm, $wParam, $lParam) ;suppress repainting to avoid flickering but causes some other side effects #forceref $iMsgm, $wParam, $lParam, $hWnd Local Const $hBrush = _WinAPI_CreateSolidBrush(0xEFCDAB) ;BGR format ;~ _WinAPI_RedrawWindow($__g_hGUI_MarkArea, 0, 0, BitOR($RDW_NOERASE, $RDW_NOCHILDREN, $RDW_NOFRAME, $RDW_VALIDATE)) _WinAPI_SetClassLongEx($__g_hGUI_MarkArea, $GCL_HBRBACKGROUND, $hBrush) _WinAPI_DeleteObject($hBrush) Return 0 EndFunc ;==>WM_ERASEBKGND ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext Func _WinAPI_SetProcessDpiAwarenessContext($DPIAwareContext = $Context_PerMonitorAware, $hGUI = 0, $iMode = 3) ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext $DPIAwareContext = ($DPIAwareContext < -5) ? -5 : ($DPIAwareContext > -1) ? -1 : $DPIAwareContext $iMode = ($iMode < 1) ? 1 : ($iMode > 3) ? 3 : $iMode Switch $iMode Case 1 Local $hDC = _WinAPI_GetDC($hGUI) Local $aResult1 = DllCall("user32.dll", "ptr", "GetDpiFromDpiAwarenessContext", "ptr", $hDC) If @error Or Not IsArray($aResult1) Then Return SetError(11, 0, 0) _WinAPI_ReleaseDC(0, $hDC) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult1[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(12, 0, 0) Case 2 ;~ If Not $hGUI Then $hGUI = WinGetHandle(AutoItWinGetTitle()) Local $aResult2 = DllCall("user32.dll", "int", "GetWindowDpiAwarenessContext", "ptr", $hGUI) If @error Or Not IsArray($aResult2) Then Return SetError(21, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult2[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(22, 0, 0) Case 3 Local $aResult31 = DllCall("user32.dll", "ptr", "GetThreadDpiAwarenessContext") If @error Or Not IsArray($aResult31) Then Return SetError(31, 0, 0) Local $aResult32 = DllCall("user32.dll", "ptr", "GetAwarenessFromDpiAwarenessContext", "ptr", $aResult31[0]) If @error Or Not IsArray($aResult32) Then Return SetError(32, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetThreadDpiAwarenessContext", "int", $aResult32[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(33, 0, 0) EndSwitch Return 1 EndFunc ;==>_WinAPI_SetProcessDpiAwarenessContext Just press the lmb and move your mouse. When lmb is released you can adjust the size of the window by dragging the white rectangle to any direction. Rmb will move the marked area. Press ESC to get the coordinates of the marked region. If you have any improvements, please post it here. Tested on Win10 x64 only. -
Hello, dear. I am a newbie in autoit language I don't master any other programming language. I also don't understand how to manage the DLL files In addition to all this I am blind, and as we all know the explanations provided for the blind in programming are very few. So I'm trying to rely on myself for learning. I work hard to design some simple software and tools that make it easier to use computers, as they perform some tasks that may be difficult for the blind. I am also looking for the programs that the blind need and cannot use it because it's haven't the compatibility with the screen reader, and i try to design a simple programs that do the same work. In these tools and programs I have to deal directly with screen readers, when i must to forcing these programs to read some processes and tasks that it cannot be read in normal mode. To force these programs to read, I have to deal with the API files. And as I said, I'm very weak in managing DLLs. So I hope you'll try to help me, please. I did a lot of research until I found the API file to manage the free screen reader (NVDA). It is open source It is based on CPP language and Python And I don't understand the both languages. For this I decided to put you an API file link here which is attached with it examples, source and DLL file I hope you can help me by convert these functions to AutoIt include file I offer you a very serious apology if the participation is a violation of the laws. I wish I could find here someone to help me. To download the file please click on this link http://www.nvda-project.org/nvdaControllerClient/nvdaControllerClient_20100219.7z and To download the free screen reader, please following this link https://www.nvaccess.org/download/ I repeat my apologies and thanks in advance.
-
MS Splash Screens The office 2016/17 office suite has made many people turn heads with its functions and especially their splash screen. I now present to you, the MS Style Splash Screen. For Rookies, Novices and anyone who wants a ready made splash screen for your gui application. You can now download it and also try it out yourself. You have three colors to choose from: Blue Red Green All three colours are from the famous programs. I also included the KODA form to you can have freedom with this splash screen. Note: the KODA form does not have the three colours as well as the correct blue. Have fun and enjoy. Note: Thanks to kaz for updating the side scrolling dots.
-
Hello, i am searching for a function that allows me some very specific functions for Screen Captures. First should be the possibillity to create a Screenshot from a specific window and this is possibly under another window but has to stay there and not getting forced to be in the first - layer position if this is clear enough :-) The other thing should be the ability to create a Screen Capture every couple minutes or a specific period. I tried a lot of Screen Capture tools but neither can do both together. Also my try to create my own script with AutoIT failed, because of missing knoweledge about how to use it for this specific reasons, would be very kind if someone can tell me in the first place if this is possible at all and maybe someone has allready an idea about how to realize it? best regards
-
Hi All, I know many newbies search for this feature. I decided to share this piece of code with everyone. Basically its a "splash screen" that has a transparent image. In a nutshell - Gui with a transparent gif. Enjoy... Download attachment.... Splash Screen GUI.zip
- 1 reply
-
- transparent
- splash
-
(and 3 more)
Tagged with:
-
Screenshot program that can upload/FTP to website/storage with hotkey. Features GUI to display programmable keys. Set the hotkeys with this function to use, and display hotkeys. ; hotkey_set() Parameters: ; ----------------------------------------------------------- ; $aHotkey - The array hotkeys are stored in. This function sets the values of this array[hotkey_id][$hotkey_data] ; $dHotkey_id - The enum for this hotkey index ; $sHotkey_description - The label displayed to the user to represent function of hotkey ; $sHotkey_name - The hotkey it'self. Whatever name string you want to give the key ; $dHotkey_key - The _IsPressed keycode ; Keycodes AT: https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm ; $dHotkey_shift - Shift flag 0 or 1 Default off ; $dHotkey_ctrl - Ctrl flag 0 or 1 Default off ; $dHotkey_alt - Alt flag 0 or 1 Default off Func hotkey_set(ByRef $aHotkey, $dHotkey_id, $sHotkey_description, $sHotkey_name, $dHotkey_key, $dHotkey_shift = 0, $dHotkey_ctrl = 0, $dHotkey_alt = 0) $aHotkey[$dHotkey_id][$eHotkey_data_key_description] = $sHotkey_description $aHotkey[$dHotkey_id][$eHotkey_data_key_name] = $sHotkey_name $aHotkey[$dHotkey_id][$eHotkey_data_key] = $dHotkey_key $aHotkey[$dHotkey_id][$eHotkey_data_shift] = $dHotkey_shift $aHotkey[$dHotkey_id][$eHotkey_data_ctrl] = $dHotkey_ctrl $aHotkey[$dHotkey_id][$eHotkey_data_alt] = $dHotkey_alt EndFunc ;==>hotkey_set ; You can set your hotkeys here ; Please visit the hotkey_set() function for parameter information hotkey_set($aHotkey, $eHotkey_screenshot_ftp, "Selected Window to FTP", "F12", "7B", 0, 1, 0); F12 hotkey_set($aHotkey, $eHotkey_screenshot_disk, "Selected Window to Disk", "S", "53", 1, 1, 1); S hotkey_set($aHotkey, $eHotkey_clipboard_send, "Send Clipboard keystrokes", "F10", "79", 1, 1, 1); F10 Configure settings dialog: Screenshot Filename and Screenshot Counter, are used to create simple unique filenames that can cycle. Copy URL to clipboard option. - For linking your screenshots. The screenshot file type is for local copy only. App always uses .JPG for FTP right now, but I could add FTP screenshot file type specification. Any suggestions? Did I break anything, what did I miss? Package uses TTS.au3 by Beege: FTP_Screen.zip File includes: - FTP_Screen.au3 - FTPScreen.ico - TTS.au3 - by Beege
-
Hello How can I make the GUI is compatible with all screen sizes ?? #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 623, 445, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZE)) GUISetBkColor(0x1E1E1E) $Label1 = GUICtrlCreateLabel("Welcome Back !!", 424, 64, 161, 29) GUICtrlSetFont(-1, 16, 400, 0, "Tahoma") GUICtrlSetColor(-1, 0x800000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd How do I make Gui interface compatible with all screen sizes ?? 800*600 1024*768 1280*1024
-
hello everyone, I'm new with AutoIT and just looking for a way to open Firefox with random window size i have tried too many different samples from the web, some how it works but i can't make it works with Firefox MozRpel and ff.au3 installed right now i can open Firefox with this code, but i still can't control the window of Firefox ; open firefox #include <ff.au3> _FFStart() ; open firefox with random size
-
Hey I was looking for methode to get the stream size of a picture from memory , wihtout need to write stream data to disk the then use filegetsize Thats what I am trying to do #include <gdiplus.au3> #include <memory.au3> #include <staticconstants.au3> _GDIPlus_Startup() Global $ghGDIPDLL = $__g_hGDIPDll While 1 $data = Desk_Stream(50) $data2 = StringSplit($data, "|") $My_Stream_Size = $data2[0] $My_Stream = $data2[1] ;. ;.. ;... Sleep(1000) WEnd _GDIPlus_Shutdown() Func Desk_Stream($Q) Local $hHBmp = _ScreenCapture_Capture("") ;create a GDI bitmap by capturing my desktop Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ;convert GDI bitmap to GDI+ bitmap Local $hBitmap_Scaled = _GDIPlus_ImageResize($hBitmap, @DesktopWidth / 2, @DesktopHeight / 2) ;resize image $sStream_Data = _GDIPlus_StreamImage2BinaryString($hBitmap_Scaled, $sQ, False, '') ;coded by UEZ 2013 build 2014-01-25; based on the code ;release resources otherwise memory leak _WinAPI_DeleteObject($hHBmp) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_ImageDispose($hBitmap_Scaled) Local $data_size = GetStreamSize($sStream_Data) Return $data_size & "|" & $sStream_Data EndFunc ;==>Desk_Stream Func _GDIPlus_StreamImage2BinaryString($hBitmap, $iQuality, $bSave, $sFilename) ;coded by UEZ 2013 build 2014-01-25; based on the code by Andreik Local $sImgCLSID, $tGUID, $tParams, $tData $sFormat = "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString Func GetStreamSize($data) ; ?? EndFunc
-
Hello forums, I'd like to know if anyone has better idea than what I have. I'm creating a program that will detect (not OCR!) blocks of words (black text) on a white background displayed on the screen. (If anyone is curious about its purpose, this code will be part of a program that will randomly select a word on a PDF file and have the user guess that word. I'll be using it to quiz myself with my PDF notes. ) What I created so far: Using FastFind.au3, I was able to make it detect lines of black text (font Lucida Console) on a single column. It basically considers a line a separate one if bounded above and below by horizontal lines that do not contain black pixels. Next step, which I haven't done yet, will be to go through each line and detect the blocks of words. The program works fine so far with Lucida Console font but it doesn't when tested on TNR font (see attached sample image). The former can be tested by setting $iOption to "text" while the latter by setting it to "select". So does anyone have a better idea on going about this? Thank you! Sorry if my code's a mess. I tried to make it cleaner before posting it but this is the best I can manage. #include <FastFind.au3> #include <array.au3> HotKeySet('{ESC}', '__Exit') Local $iImagePos[4], $iXa, $iXb, $iYa, $iYb $iOption = 'text' Switch $iOption Case 'text' ; Creates sample text file for detection Local Const $sSampleTextFileName = 'sample.txt' FileWrite($sSampleTextFileName, '') FileOpen($sSampleTextFileName, 2) FileWrite($sSampleTextFileName, 'First line.' & @CRLF & 'Second line.' & @CRLF & @CRLF & 'Third line.') FileClose($sSampleTextFileName) ShellExecute($sSampleTextFileName) Local Const $sSampleTextFileTitle = 'sample - Notepad' WinWait($sSampleTextFileTitle) WinMove($sSampleTextFileTitle, '', 0, 0, @DesktopWidth / 2, @DesktopHeight / 2) Sleep(500) $iImagePos = __ControlGetPos($sSampleTextFileTitle, '[CLASS:Edit; INSTANCE:1]') ; Gets the absolute coordinates of the edit control. Local $iXa = $iImagePos[0], _ $iXb = $iImagePos[0] + $iImagePos[2], _ $iYa = $iImagePos[1], _ $iYb = $iImagePos[1] + $iImagePos[3] Case 'select' MsgBox(0, 'Select', 'Select first') $iXa = MouseGetPos(0) $iYa = MouseGetPos(1) MsgBox(0, 'Select', 'Select second') $iXb = MouseGetPos(0) $iYb = MouseGetPos(1) EndSwitch Local $array[1][2] ; Will be used for saving coordinates of lines of text Local $iBlackPixelCount Local $bHasNoPreviousZero = True ; Will be used as a toggle for skipping succeeding lines that have no black pixels. Local $iStep = 1 For $y = $iYa To $iYb Step $iStep FFSnapShot($iXa, $y, $iXb, $y) $iBlackPixelCount = FFColorCount(0x000000, 50, False) ; $iBlackPixelPercent = Round(100 * (FFColorCount(0x000000, 0, False) / $iImagePos[2]), 2) ; Computes for percentage of black pixels on horizontal line. ; If $iBlackPixelCount > 0 Or $bHasNoPreviousZero Then ; $bHasNoPreviousZero = True _ArrayAdd($array, $iBlackPixelCount) $array[UBound($array) - 1][1] = $y ; If $iBlackPixelCount = 0 Then $bHasNoPreviousZero = False ; EndIf Next ; To check detected lines. This will move mouse to the lower-left corner of the text line. For $i = 0 To UBound($array) - 1 Step +1 If $array[$i][0] > 0 Then If $i + 1 <= UBound($array) - 1 Then If $array[$i + 1][0] = 0 Then MouseMove($iXa, $array[$i][1]) Sleep(500) EndIf EndIf ; EndIf Next _ArrayDisplay($array) Func __ControlGetPos($hWnd, $controlID, $bAbsolute = Default) ;; https://www.autoitscript.com/forum/topic/88345-absolute-position-of-guicontrol/ If $bAbsolute = Default Then $bAbsolute = True Local $controlPos Switch $bAbsolute Case True Local Const $hWnd_Control = ControlGetHandle($hWnd, "", $controlID) $controlPos = WinGetPos($hWnd_Control) Case False $controlPos = ControlGetPos($hWnd, "", $controlID) EndSwitch If Not IsArray($controlPos) Then SetError(1) Return $controlPos EndFunc ;==>__ControlGetPos Func __Exit() Exit EndFunc ;==>__Exit FastFind.dll FastFind.au3 FastFind64.dll sample image.bmp
-
XvidCapture, demo capturing made easy, into avi video file with stereo sound. Script use XvidCapture.dll made for freebasic by D.J.Peters Major defects : The frame rate need to be limited due to the time for write datas (80-130 ms by frame with a 1920x1080 screen size and a 640x480 video size). The dll support only uncompressed wav audio format (do not work with mp3) The quality setting doesn't seem to change anything. Tested with AutoIt 3.3.8.1 on WinXP SP3 and AutoIt 3.3.12.0 on Win7/Win8.1 On my netbook using XP, i need to set fps to 5 with 320x240 ! On my Destop PC using W7 or W8.1 , i need to set fps to 7 with 854x480 ! So don't expect a video in high-definition with dolby surround from a little dll of 153 ko ! If FPS can be respected by the script, the audio and video can be synchronized, so adjust settings depending on the config of your pc. As usual externals files are embedded in script. Thanks to Smashly for his wave functions and also UEZ, Authenticity, Eukalyptus and jpm for the new GDIPLUS functions. source for 3.3.12.0 : XvidCapture v1.0.1.6.au3.html source for previous versions : XvidCapture v1.0.1.6 PreviousAutoItVersions.au3.html executable : XvidCapture.exe.html
-
I am trying to make a script that changes the active display screen. I got a setup with 3 screens and can only have 2 active screens at the same time, so I want to automate the process by making a script for it. Screen 1(Main) and 2(Extended) are my main screens. I also got a third screen that I use for watching movies and such. I've tried searching both the forum and google for relevant problems, but I can't seem to find anything. Also tried looking for the display settings in the registry, but gave up searching without any idea what to look for. Do you guys got any tips? Regards, Akarillon
-
I have found the code to do this, but I am wondering how you would change to a second monitor. Found the code here, but it might be located on different posts... ;=============================================================================== ; ; Function Name: _ChangeScreenRes() ; Description: Changes the current screen geometry, colour and refresh rate. ; Version: 1.0.0.1 ; Parameter(s): $i_Width - Width of the desktop screen in pixels. (horizontal resolution) ; $i_Height - Height of the desktop screen in pixels. (vertical resolution) ; $i_BitsPP - Depth of the desktop screen in bits per pixel. ; $i_RefreshRate - Refresh rate of the desktop screen in hertz. ; Requirement(s): AutoIt Beta > 3.1 ; Return Value(s): On Success - Screen is adjusted, @ERROR = 0 ; On Failure - sets @ERROR = 1 ; Forum(s): <a href='http://www.autoitscript.com/forum/index.php?showtopic=20121' class='bbc_url' title=''>http://www.autoitscript.com/forum/index.php?showtopic=20121</a> ; Author(s): Original code - psandu.ro ; Modifications - PartyPooper ; ;=============================================================================== Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh) Local Const $DM_PELSWIDTH = 0x00080000 Local Const $DM_PELSHEIGHT = 0x00100000 Local Const $DM_BITSPERPEL = 0x00040000 Local Const $DM_DISPLAYFREQUENCY = 0x00400000 Local Const $CDS_TEST = 0x00000002 Local Const $CDS_UPDATEREGISTRY = 0x00000001 Local Const $DISP_CHANGE_RESTART = 1 Local Const $DISP_CHANGE_SUCCESSFUL = 0 Local Const $HWND_BROADCAST = 0xffff Local Const $WM_DISPLAYCHANGE = 0x007E If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth ; default to current setting If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight ; default to current setting If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth ; default to current setting If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh ; default to current setting Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]") Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DllStructGetPtr($DEVMODE)) If @error Then $B = 0 SetError(1) Return $B Else $B = $B[0] EndIf If $B <> 0 Then DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5) DllStructSetData($DEVMODE, 4, $i_Width, 2) DllStructSetData($DEVMODE, 4, $i_Height, 3) DllStructSetData($DEVMODE, 4, $i_BitsPP, 1) DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5) $B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_TEST) If @error Then $B = -1 Else $B = $B[0] EndIf Select Case $B = $DISP_CHANGE_RESTART $DEVMODE = "" Return 2 Case $B = $DISP_CHANGE_SUCCESSFUL DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_UPDATEREGISTRY) DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _ "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width) $DEVMODE = "" Return 1 Case Else $DEVMODE = "" SetError(1) Return $B EndSelect EndIf EndFunc ;==>_ChangeScreenRes My issue is that I share this desktop with other people...everyone likes to have their own resolutions. I like 1280*1024, where is my coworker likes 1600*1200. I have a script that both of us run all day long, and was trying to change screen on the fly, once the script starts. The trouble: I want all monitors to be the same resolution. As it sits right now, I call this function with my resolution, and would hope it would change all, but only changes one monitor. How do I add to this function to change all or a single monitor to the size I want. Oh, why I say this, all our monitors are not the same, so potentially it could be one changed one way and another change another way. Hope I am clear as mud...trying to automatically change display settings, based on user that is on the computer. EDIT - i might have found it in the link i posted as that link is not the same code
- 1 reply
-
- resolution
- screen
-
(and 1 more)
Tagged with:
-
Hello, i need help with my script here. I want to detect when my Screen is nearly or completly dark/black. I'm using PixelChecksum(0,0,1919,1079) and it's giving me random numbers (e.g. 2690216355, 2589900821, 854331631, 481460664) How can i compare that with a Black like 0xFFFFFF ?
- 1 reply
-
- Screen
- Pixelchecksum
-
(and 1 more)
Tagged with:
-
hello guys i have a little question, if i wrote this $destination = "C:\Picture.Jpg" ;This only are Example SplashImageOn("Splash Screen", $destination,250,50) Sleep(3000) SplashOff() MsgBox(0,"Title","Text") the Splash Screen will Display First, after that the msg will appear i want the splash and the message box display together