Leaderboard
Popular Content
Showing content with the highest reputation on 10/23/2018 in all areas
-
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.1 point
-
Text File Decode
Philips reacted to Earthshine for a topic
https://www.autoitscript.com/autoit3/docs/functions/BitShift.htm AutoIt has Bitshift and all the Bit functions you need, you might be able to code this1 point -
Text File Decode
Philips reacted to Earthshine for a topic
so anyway, they are filling a buffer with some data from a file they read, and then scanning it--looks like output goes to file or console, for what I don't know1 point -
Text File Decode
Philips reacted to Earthshine for a topic
looks like some bit shifting to begin with... https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators you got a lot to learn to understand that one kid... lol One of my bosses loves bitmasking... lol, like we are in the old school days and don't have enough ram, you can load a boatload of flags into an integer... ahhh the old C days.... they use an integer (in binary) to store a bunch of flags for later use and use bit-masking to reveal what they want. this does save big on ram usage instead of one variable per flag... that's why we used to use it so much in the olden days... LOL1 point -
Text File Decode
Philips reacted to Davidowicza for a topic
@Philips, Saying "I don't understand this:" isn't much help. Do you just not understand how to read javascript, do you not know why that script does those 3 lines or you do not know how to convert those 3 lines? Because we wouldn't know either until you tell us what the purpose of the script is and what you expect from the outcome.1 point -
Convet each array value to Int the use arraysort. Saludos1 point
-
Text File Decode
Philips reacted to FrancescoDiMuro for a topic
Hi @Philips, and welcome to the AutoIt forum Maybe you missed the part in the Forum Etiquette. By the way, start to take a look at File* and _File* functions in the Help file1 point -
hi Emmhor1, See if you can use anything out from this example I have just posted about .. Deye1 point
-
I'll help you, and that's <> than doing it FOR you, besides it's easy enough so you can at least try. A condition is for example: If $varX = 1 Then So if you put conditions, inside the main loop, and under these conditions, code to execute, this means you select what you want to get executed, just need to change the variables value. You can have for example checkboxes corresponding to what sections you want executed, the checkbox can be read, also in the main loop, and depending on checked or not, set the variable to 1 or 0. That simple.1 point
-
Run 2 functions at the same time would be multithreading so no. But you could have it all in the main loop, set the conditions and it would run sequentially. And there's adlib.1 point
-
If you want to scale: ;#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Icon_Add=Resources\AddRemApp.ico #AutoIt3Wrapper_Icon=Resources\AddRemApp.ico #AutoIt3Wrapper_Run_Tidy=n #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPI.au3> #include <GuiEdit.au3> #include <GuiButton.au3> #include <Constants.au3> #include <GuiStatusBar.au3> #include <GUIConstants.au3> #include <GuiImageList.au3> #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("TrayMenuMode", 1) Opt("TrayIconHide", 1) Opt("GUIResizeMode", 1) Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("MouseCoordMode", 2) Opt("GUIOnEventMode", 0) Opt("MustDeclareVars", 0) Opt("GUIEventOptions", 1) Opt("TrayOnEventMode", 1) Opt("ExpandEnvStrings", 1) Opt("WinDetectHiddenText", 1) FileInstall("AutoIt Checkboxes Installation.au3", @ScriptDir & '\AutoIt Checkboxes Installation.au3', 1) TraySetIcon("IMG\install2.ico") Local $STR1 = StringInStr(@ScriptDir, '\', 2, 2) Local $STR2 = StringLeft(@ScriptDir, $STR1) $hGUI = GUICreate("AutoIt Install Menu", 740, 250, 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") $hlabel = GUICtrlCreateLabel("Select a Program to install", 30, 10, 126, 17) $hButton1 = GUICtrlCreateButton("Start", 30, 200, 50) $hButton2 = GUICtrlCreateButton("Select All", 80, 200, 80) $hButton3 = GUICtrlCreateButton("UnSelect All", 160, 200, 80) $totray = TrayCreateItem("Tray") TrayItemSetOnEvent($totray, "ToTray") $restore = TrayCreateItem("Restore") TrayItemSetOnEvent($restore, "Restore") $exititem = TrayCreateItem("Close") TrayItemSetOnEvent($exititem, "Quit") GUISetState() Global $aRadio[32] Global $aApps[32][3] $aApps[0][0] = "W10Tools" $aApps[0][1] = "W10Tools.exe" $aApps[0][2] = "IMG\Pc.ico" $aApps[1][0] = "SMP" $aApps[1][1] = "AutoIt SMP.exe" $aApps[1][2] = "IMG\SMP.ico" $aApps[2][0] = "LAN" $aApps[2][1] = "AutoIt LAN.exe" $aApps[2][2] = "IMG\realtek.ico" $aApps[3][0] = "Obsidian" $aApps[3][1] = 'Obsidian\Obsidian.bat' $aApps[3][2] = "Obsidian\normal.ico" $aApps[4][0] = "Java" $aApps[4][1] = "AutoIt Java.exe" $aApps[4][2] = "IMG\java.ico" $aApps[5][0] = "DX9c" $aApps[5][1] = "AutoIt DX9c.exe" $aApps[5][2] = "IMG\dx9c.ico" $aApps[6][0] = "Create Synchronicity 6.0" $aApps[6][1] = "Create Synchronicity 6.0.exe" $aApps[6][2] = "IMG\sync.ico" $aApps[7][0] = "Firefox" $aApps[7][1] = "AutoIt FFox.exe" $aApps[7][2] = "IMG\fox.ico" $aApps[8][0] = "Group Policy Tool" $aApps[8][1] = "GroupPolicy W10 X64\GPO Tool.exe" $aApps[8][2] = "IMG\gpls.ico" $aApps[9][0] = "Notepad ++" $aApps[9][1] = "Notepad ++ 7.5.2 SFX.exe" $aApps[9][2] = "IMG\notepad.ico" $aApps[10][0] = "PowerCfgW10" $aApps[10][1] = "PowerCfgW10.exe" $aApps[10][2] = "IMG\power.ico" $aApps[11][0] = "FlashPlayer" $aApps[11][1] = "AutoIt FlashPlayer.exe" $aApps[11][2] = "IMG\flashplayer.ico" $aApps[12][0] = "WinRar" $aApps[12][1] = "AutoIt WinRar.exe" $aApps[12][2] = "IMG\winrar.ico" $aApps[13][0] = "Foxit Reader" $aApps[13][1] = "FoxitReaderPortable.exe" $aApps[13][2] = "IMG\foxit.ico" $aApps[14][0] = "Realtek R*" $aApps[14][1] = "AutoIt RLTK x64.exe" $aApps[14][2] = "IMG\realtek.ico" $aApps[15][0] = "AutoIt + SciTE" $aApps[15][1] = "AutoIt AutoIt + SciTe Silent.exe" $aApps[15][2] = "IMG\autoit.ico" $aApps[16][0] = "PhysX" $aApps[16][1] = "AutoIt PhysX.exe" $aApps[16][2] = "IMG\physx.ico" $aApps[17][0] = "FM2 Chipset" $aApps[17][1] = "F2A85M-LE\FM2_Chipset\Setup.exe" $aApps[17][2] = "IMG\amd.ico" $aApps[18][0] = "Logitech SetPoint" $aApps[18][1] = "AutoIt Logitech SetPoint.exe" $aApps[18][2] = "IMG\logitech.ico" $aApps[19][0] = "Logitech GS" $aApps[19][1] = "AutoIt LGS.exe" $aApps[19][2] = "IMG\lgs.ico" $aApps[20][0] = "Synaptics 17.0.19C" $aApps[20][1] = "AutoIt Synaptics 17.0.19C.exe" $aApps[20][2] = "IMG\synaptics.ico" $aApps[21][0] = "Fraps" $aApps[21][1] = "AutoIt Fraps.exe" $aApps[21][2] = "IMG\fraps.ico" $aApps[22][0] = "Reserved" $aApps[22][1] = "" $aApps[22][2] = "IMG\Blank.ico" $aApps[23][0] = "Reserved" $aApps[23][1] = "" $aApps[23][2] = "IMG\Blank.ico" $aApps[24][0] = "Reserved" $aApps[24][1] = "" $aApps[24][2] = "IMG\Blank.ico" $aApps[25][0] = "Reserved" $aApps[25][1] = "" $aApps[25][2] = "IMG\Blank.ico" $aApps[26][0] = "Reserved" $aApps[26][1] = "" $aApps[26][2] = "IMG\Blank.ico" $aApps[27][0] = "Reserved" $aApps[27][1] = "" $aApps[27][2] = "IMG\Blank.ico" $aApps[28][0] = "Reserved" $aApps[28][1] = "" $aApps[28][2] = "IMG\Blank.ico" $aApps[29][0] = "Reserved" $aApps[29][1] = "" $aApps[29][2] = "IMG\Blank.ico" $aApps[30][0] = "Reserved" $aApps[30][1] = "" $aApps[30][2] = "IMG\Blank.ico" $aApps[31][0] = "Reserved" $aApps[31][1] = "" $aApps[31][2] = "IMG\Blank.ico" For $i = 0 To 3 For $j = 0 To 7 $sName = ($aApps[($i * 8) + $j][0]) GUICtrlCreateIcon($aApps[($i * 8) + $j][2], -2, 30 + ($i * 160), 30 + ($j * 20), 17, 17) $aRadio[($i * 8) + $j] = GUICtrlCreateCheckbox($sName, 50 + ($i * 160), 30 + ($j * 20), 138, 20) Next Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton1 For $i = 0 To 29 If BitAND(GUICtrlRead($aRadio[$i]), $GUI_CHECKED) = $GUI_CHECKED Then If Not FileExists($aApps[$i][1]) Then MsgBox(262160, "File not found!", $aApps[$i][1], 0) Else ConsoleWrite("Running: " & $aApps[$i][0] & @CRLF) ShellExecuteWait($aApps[$i][1]) TrayTip('Installer', "Running: " & $aApps[$i][0], 3) EndIf EndIf Next ;================================================ Case $hButton2 ;All For $i = 0 To 21 GUICtrlSetState($aRadio[$i], $GUI_CHECKED) Next ;================================================ Case $hButton3 ;None For $i = 0 To 31 GUICtrlSetState($aRadio[$i], $GUI_UNCHECKED) Next EndSwitch WEnd Func ToTray() TrayItemSetState($totray, $TRAY_UNCHECKED) GUISetState(@SW_HIDE) EndFunc ;==>ToTray Func Restore() TrayItemSetState($restore, $TRAY_UNCHECKED) GUISetState(@SW_SHOW) EndFunc ;==>Restore Func Quit() Exit EndFunc ;==>Quit1 point
-
Just using this simple example, both execute for me. #include <GUIConstantsEx.au3> #pragma compile(Icon, C:\Program Files (x86)\AutoIt3\Aut2Exe\Icons\AutoIt_Main_v10_48x48_256.ico) ;CHECK BOXES $gui=GUICreate("VidaXL App Installer", 500, 340) $app1 = GUICtrlCreateCheckbox("Char1", 20, 30, 120, 20) $app2 = GUICtrlCreateCheckbox("Char2", 20, 50, 120, 20) $select=GUICtrlCreateButton("Select All", 20, 235, 100, 20) $deselect=GUICtrlCreateButton("Deselect All", 20, 255, 100, 20) $button=GUICtrlCreateButton("Start Installation", 150, 290, 200, 20) $cancelbutton=GUICtrlCreateButton("Cancel", 150, 310, 200, 20) $msg=GUISetState() While 1 Switch GUIGetMsg() Case $select GUICtrlSetState($app1, $GUI_CHECKED) GUICtrlSetState($app2, $GUI_CHECKED) Case $deselect GUICtrlSetState($app1, $GUI_UNCHECKED) GUICtrlSetState($app2, $GUI_UNCHECKED) Case $button If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then Char1() EndIf If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then Char2() EndIf Case $GUI_EVENT_CLOSE MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat') Exit Case $cancelbutton MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat') Exit EndSwitch WEnd Func Char1() msgbox(0,"","char1") EndFunc Func Char2() msgbox(0,"","char2") EndFunc Perhaps there is something else in your full script causing issue?1 point
-
You do not need to use Call() just change this: If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then Call("Char1") EndIf If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then Call("Char2") EndIf to: If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then Char1() EndIf If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then Char2() EndIf1 point
-
This is a quick modyfication for GUICreate() first Example from HelpFile : #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idOK _ButtonOK_Pressed() EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Func _ButtonOK_Pressed() MsgBox($MB_ICONINFORMATION, 'Info', 'Button OK Pressed') EndFunc ;==>_ButtonOK_Pressed I this what you are looking for ?1 point
-
WilliamasKumeliukas, Try this code which dynamically resets the font size each time you resize the GUI: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include "StringSize.au3" Opt("GUIResizeMode", 802) Opt("GUICloseOnEsc", 1) Global $q = "INTRO LINE" & @CRLF & @CRLF & "description of everything until user press start." Global $iGUIInitSize = 550 Main() Func Main() ;Global $iGUIInitSize = 550 ;Opt("GUICloseOnEsc", 1) Global $gui = GUICreate("example", 1124, 550, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)) Global $gui_size = WinGetClientSize($gui) Global $iFontSize = Int(2 * (.25 + (8 * $gui_size[0] / $iGUIInitSize))) / 2 Global $timer = GUICtrlCreateLabel("", 752, 472, 294, 30, $WS_BORDER) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) GUICtrlSetFont(-1, $iFontSize) ;GUICtrlSetState($timer, $GUI_HIDE) Global $info = GUICtrlCreateLabel($q, 200, 20, 700, 200, $SS_CENTER) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) $fi = GUICtrlSetFont($info, $iFontSize) GUICtrlSetBkColor(-1, 0x00FF00) Global $a = GUICtrlCreateRadio("A)", 50, 210, 500, 100, $BS_MULTILINE, $WS_EX_CLIENTEDGE) $fa = GUICtrlSetFont($a, 15) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) ;GUICtrlSetState($a, 16) Global $b = GUICtrlCreateRadio("B)", 50, 310, 500, 100, $BS_MULTILINE, $WS_EX_CLIENTEDGE) $fb = GUICtrlSetFont($b, 15) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) ;GUICtrlSetState($b, 16) Global $c = GUICtrlCreateRadio("C)", 612, 210, 500, 100, $BS_MULTILINE, $WS_EX_CLIENTEDGE) $fc = GUICtrlSetFont($c, 15) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) ;GUICtrlSetState($c, 16) Global $d = GUICtrlCreateRadio("D) ", 612, 310, 500, 100, $BS_MULTILINE, $WS_EX_CLIENTEDGE) $fd = GUICtrlSetFont($d, 15) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) ;GUICtrlSetState($d, 16) Global $sign = GUICtrlCreateLabel("File", 420, 480, -1, -1, BitOR($SS_CENTER, $WS_BORDER)) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) GUICtrlSetFont($sign, 12) Global $yb = GUICtrlCreateRadio("True", 200, 420, 200, 50, $BS_PUSHLIKE) GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM) GUICtrlSetFont($yb, 15) ;GUICtrlSetState($yb, 32) Global $nb = GUICtrlCreateRadio("False", 700, 420, 200, 50, $BS_PUSHLIKE) GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM) GUICtrlSetFont($nb, 15) ;GUICtrlSetState($nb, 32) Global $start = GUICtrlCreateButton("Start", 20, 20, 100, 50, $SS_CENTER, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) GUICtrlSetFont($start, 12) Global $valid = GUICtrlCreateButton("Confirm", 20, 20, 100, 50, $SS_CENTER, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) GUICtrlSetFont($valid, 12) GUICtrlSetState($valid, 32) GUISetState(@SW_SHOW) $sText = "This long string is an example as string that I want to fit in 4 radio buttons because sometimes it can be that long. " While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Switch MsgBox(4096 + 4, "Warning", "Are you sure to exit?") Case 6 Exit Case 7 ContinueLoop EndSwitch Case $start, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE ; Check for fit each time the control size changes ; Get current size of radio label $aPos = ControlGetPos($gui, "", $a) ; Determine largest font that will fit in the available rectangle $sFormattedText = _GetFontSize("A) " & $sText, $aPos) ; Set font size for control GUICtrlSetFont($a, @extended) ; Write formatted text to control GUICtrlSetData($a, $sFormattedText) $sFormattedText = _GetFontSize("B) " & $sText & $sText, $aPos) ; Make text longer for each control GUICtrlSetFont($b, @extended) GUICtrlSetData($b, $sFormattedText) $sFormattedText = _GetFontSize("C) " & $sText & $sText & $sText, $aPos) GUICtrlSetFont($c, @extended) GUICtrlSetData($c, $sFormattedText) $sFormattedText = _GetFontSize("D) " & $sText & $sText & $sText & $sText, $aPos) GUICtrlSetFont($d, @extended) GUICtrlSetData($d, $sFormattedText) EndSwitch WEnd EndFunc ;==>Main Func _GetFontSize($sText, $aPos) ; Adjust this as you wish - there is a trade-off between speed and best fit For $iSize = 19 to 1 Step -2 ; Get size of rectangle needed for string at a given font size - wrapping to the available width of the rectangle $aRect = _StringSize($sText, $iSize, Default, Default, Default, $aPos[2] - 50) ; Now check if height of formatted text will fit into the available rectangle If $aRect[3] <= $aPos[3] Then ExitLoop EndIf Next ; Return formatted text with required font size in @extended Return SetError(0, $iSize, $aRect[0]) EndFunc As you can see, you get the correct font size regardless of the text length. M231 point
-
Resizing works correctly for me, when changing the "Global $a = ..." line in your script to this one : Global $a = GUICtrlCreateRadio("A)", 100, 210, 500, 100, $BS_MULTILINE)1 point
-
How to open any html file within a folder
layan232 reacted to JLogan3o13 for a topic
Hi, xcaliber13. Look at _FileListToArray in the help file. Read the contents of the folder into your array to get the filename, then use that in your script. Edit: something like this to get you started #include <File.au3> $aTemp = _FileListToArray(@DesktopDir & "\Test", "*.htm", $FLTA_FILES) If IsArray($aTemp) Then If $aTemp[0] > 1 Then ConsoleWrite("More than one HTML file found!" & @CRLF) Else ConsoleWrite($aTemp[1] & " found." & @CRLF) EndIf EndIf1 point -
ajhhanekamp, The easiest way to see if teh sound file has finished is to use the _SoundStatus function: #include <Sound.au3> HotKeySet("{ESCAPE}", "_Exit") $vSndID = _SoundOpen("your file path") While 1 If _SoundStatus($vSndID) = "stopped" Then _SoundPlay($vSndID) Sleep(10) WEnd Func _Exit() _SoundStop($vSndID) Exit EndFuncM231 point