Leaderboard
Popular Content
Showing content with the highest reputation on 03/02/2013 in all areas
-
One of the main issues AutoIt coder could have is lack of built-in data compression mechanism. Doing it "manually" is not an option because of the slowness of the interpretter. So, it's either using third party dlls (whatever) or some Windows API that exposes the funcionality. In this post I will compress data using well known GDI+. That's graphical library, so it's not straightforward approach. First I'm making BITMAP out of data and then convert that image into a PNG. PNG format includes form of compression, so at the end what's get is compressed data. Compression level is not very high compared to other methods, but considering everything - who cares . Of course that compressing string "ABC" will not make much sense and will result in, IDK 150 bytes of output because PNG includes metadata that take space, but for data in sizes of more than few KB you will see the difference. Besides you will see how your data looks if it's taken to be a picture. Script will create PNG out of itself called Test_Image.png and then read it and print to console: GDIP_Compress.au31 point
-
Program ScreenCaptureEx
AndyNutuDesigns reacted to wolf9228 for a topic
This program allows to capture the screen through three methods 1 - Select area by mouse 2 - Select Automatic 3 - Capture all child windows ScreenCaptureEx ScreenCaptureEx.zip NewScreenCaptureEx The code has been modified NewScreenCaptureEx.zip NewScreenCaptureEx.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GDIPlus.au3> Global $vChildWindwos = 0 , $CaptureTest = 0,$CapHHook = 0 , $MouseGui = 0,$RgnGui = 0 Global $TrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") , $MouseHHook = 0,$MouseGui = 0 Global $ButtonWnd = WinGetHandle("[CLASS:Button]") , $CaptureMouseTest = 0 Global $START_X , $START_Y , $IMGE_L = 0 , $IMGE_T = 0,$IMGE_W = 0 , $IMGE_H = 0 Global $InitDir1 = @MyDocumentsDir , $InitDir2 = $InitDir1 , $InitDir3 = $InitDir1 Global $InitDir4 = $InitDir1 , $InitDir5 = $InitDir1 , $InitDir6 = $InitDir1 Global $InitDir7 = $InitDir1, $InitDir8 = $InitDir1,$Num1,$Num2,$Num3,$Num4,$Num5 $ScreenGui = GUICreate("ScreenCaptureEx",230,245,(@DesktopWidth / 2) - 115, (@DesktopHeight / 2) - 123) GUISetBkColor(15790320) GUICtrlCreateGroup("ScreenCapture", 10, 10, 210,225) $Button_1 = GUICtrlCreateButton("Select area by mouse", 15, 35, 200 , 30) $Button_2 = GUICtrlCreateButton("Select Automatic", 15, 70, 200 , 30) $Button_3 = GUICtrlCreateButton("Capture all child windows", 15, 105, 200 , 30) $Button_4 = GUICtrlCreateButton("Exit", 15, 140, 200 , 30) $Checkbox1 = GUICtrlCreateCheckbox("Hide taskbar", 50, 175, 130, 30) $Checkbox2 = GUICtrlCreateCheckbox("Capture by any key", 33, 200, 167, 30) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $Button_1 $ShowTaskBar = Not(BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) == $GUI_CHECKED) $MousehBitmap = Mouse_Capture($ScreenGui,$ShowTaskBar) if Not @error Then SaveImage($MousehBitmap) GUISetState(@SW_SHOW,$ScreenGui) GUISwitch($ScreenGui) Case $msg = $Button_2 Dim $AutohBitmap = 0 $ShowTaskBar = Not(BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) == $GUI_CHECKED) If BitAND(GUICtrlRead($Checkbox2),$GUI_CHECKED) = $GUI_CHECKED Then $AutohBitmap = AutoCapture($ScreenGui,1,$ShowTaskBar) Else $AutohBitmap = AutoCapture($ScreenGui,0,$ShowTaskBar) EndIf if Not @error Then SaveImage($AutohBitmap) GUISetState(@SW_SHOW,$ScreenGui) GUISwitch($ScreenGui) Case $msg = $Button_3 $ShowTaskBar = Not(BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) == $GUI_CHECKED) If BitAND(GUICtrlRead($Checkbox2),$GUI_CHECKED) = $GUI_CHECKED Then $ImageArray = ChildsCapture($ScreenGui,1,$ShowTaskBar) Else $ImageArray = ChildsCapture($ScreenGui,0,$ShowTaskBar) EndIf if Not @error Then ChildsSaveImage($ImageArray) GUISetState(@SW_SHOW,$ScreenGui) GUISwitch($ScreenGui) Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_4 Exit EndSelect WEnd Func ChildsSaveImage($ImageArray) Local $Save_Error = 1 , $ImageExit = "" $SGui = GUICreate("Save",310,100,(@DesktopWidth - 155) / 2, (@DesktopHeight - 50) / 2) GUISetBkColor(15790320) GUICtrlCreateGroup("Save Image", 10, 10, 280, 80) $SButton_1 = GUICtrlCreateButton("BMP", 15, 33, 50 , 50) $SButton_2 = GUICtrlCreateButton("PNG", 70, 33, 50 , 50) $SButton_3 = GUICtrlCreateButton("GIF", 125, 33, 50 , 50) $SButton_4 = GUICtrlCreateButton("JPG", 180, 33, 50 , 50) $SButton_5 = GUICtrlCreateButton("Skip", 235, 33, 50 , 50) GUISetState(@SW_SHOW,$SGui) GUISwitch($SGui) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $SButton_1 $var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir5) $Save_Error = @error If Not($Save_Error) Then $InitDir5 = $var $ImageExit = ".BMP" ExitLoop EndIf Case $msg = $SButton_2 $var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir6) $Save_Error = @error If Not ($Save_Error) Then $InitDir6 = $var $ImageExit = ".PNG" ExitLoop EndIf Case $msg = $SButton_3 $var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir7) $Save_Error = @error If Not ($Save_Error) Then $InitDir7 = $var $ImageExit = ".GIF" ExitLoop EndIf Case $msg = $SButton_4 $var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir8) $Save_Error = @error If Not ($Save_Error) Then $InitDir8 = $var $ImageExit = ".JPG" ExitLoop EndIf Case $msg = $SButton_5 ExitLoop EndSelect WEnd GUIDelete($SGui) if Not($Save_Error) Then _GDIPlus_Startup () For $i = 0 To UBound($ImageArray) - 1 $hBmp = $ImageArray[$i] if ($hBmp) Then $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) _GDIPlus_ImageSaveToFile($hBitmap,$var & "\" & String($hBmp & $ImageExit)) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hBmp) EndIf Next _GDIPlus_ShutDown () Else For $i = 0 To UBound($ImageArray) - 1 $hBmp = $ImageArray[$i] if ($hBmp) Then _WinAPI_DeleteObject($hBmp) Next EndIf EndFunc Func SaveImage($hBmp) Local $Save_Error = 1 $SGui = GUICreate("Save",310,100,(@DesktopWidth - 155) / 2, (@DesktopHeight - 50) / 2) GUISetBkColor(15790320) GUICtrlCreateGroup("Save Image", 10, 10, 280, 80) $SButton_1 = GUICtrlCreateButton("BMP", 15, 33, 50 , 50) $SButton_2 = GUICtrlCreateButton("PNG", 70, 33, 50 , 50) $SButton_3 = GUICtrlCreateButton("GIF", 125, 33, 50 , 50) $SButton_4 = GUICtrlCreateButton("JPG", 180, 33, 50 , 50) $SButton_5 = GUICtrlCreateButton("Skip", 235, 33, 50 , 50) GUISetState(@SW_SHOW,$SGui) GUISwitch($SGui) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $SButton_1 $var = FileSaveDialog("Choose a name.",$InitDir1,"IMAGE(*.BMP)",2,"Untitled" & $Num1,$SGui) $Save_Error = @error If Not ($Save_Error) Then $InitDir1 = "" $Split = StringSplit($var,"\") For $J = 1 To $Split[0] - 1 $InitDir1 &= $Split[$J] & "\" Next If StringUpper(StringRight($var,4)) <> ".BMP" Then $var &= ".BMP" $Num1 += 1 ExitLoop EndIf Case $msg = $SButton_2 $var = FileSaveDialog("Choose a name.",$InitDir2,"IMAGE(*.PNG)",2,"Untitled" & $Num2,$SGui) $Save_Error = @error If Not ($Save_Error) Then $InitDir2 = "" $Split = StringSplit($var,"\") For $J = 1 To $Split[0] - 1 $InitDir2 &= $Split[$J] & "\" Next If StringUpper(StringRight($var,4)) <> ".PNG" Then $var &= ".PNG" $Num2 += 1 ExitLoop EndIf Case $msg = $SButton_3 $var = FileSaveDialog("Choose a name.",$InitDir3,"IMAGE(*.GIF)",2,"Untitled" & $Num3,$SGui) $Save_Error = @error If Not ($Save_Error) Then $InitDir3 = "" $Split = StringSplit($var,"\") For $J = 1 To $Split[0] - 1 $InitDir3 &= $Split[$J] & "\" Next If StringUpper(StringRight($var,4)) <> ".GIF" Then $var &= ".GIF" $Num3 += 1 ExitLoop EndIf Case $msg = $SButton_4 $var = FileSaveDialog("Choose a name.",$InitDir4,"IMAGE(*.JPG)",2,"Untitled" & $Num4,$SGui) $Save_Error = @error If Not ($Save_Error) Then $InitDir4 = "" $Split = StringSplit($var,"\") For $J = 1 To $Split[0] - 1 $InitDir4 &= $Split[$J] & "\" Next If StringUpper(StringRight($var,4)) <> ".JPG" Then $var &= ".JPG" $Num4 += 1 ExitLoop EndIf Case $msg = $SButton_5 ExitLoop EndSelect WEnd GUIDelete($SGui) if Not($Save_Error) Then if ($hBmp) Then _GDIPlus_Startup () $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) _GDIPlus_ImageSaveToFile($hBitmap,$var) _WinAPI_DeleteObject($hBitmap) _GDIPlus_ShutDown () _WinAPI_DeleteObject($hBmp) EndIf Else if ($hBmp) Then _WinAPI_DeleteObject($hBmp) EndIf GUISwitch($SGui) EndFunc Func Mouse_Capture($DialogWin,$ShowTaskBar = True) If Not($ShowTaskBar) Then ShowTaskBar(False) if ($DialogWin) Then $Return = GUISetState(@SW_HIDE,$DialogWin) if ($Return = 0) Then Return SetError(1,0,0) EndIf $MouseGui = GUICreate("",0,0,0,0,BitOR($WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS) , _ BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE,$DS_MODALFRAME)) GUISetBkColor(0xFF0000,$MouseGui) Local $HMod = _WinAPI_GetModuleHandle(0) if ($HMod = 0) Then GUIDelete($MouseGui) Return SetError(2,0,0) EndIf $CaptureMouseTest = 0 $RegMouseProc = DllCallbackRegister("CaptureLowLevelMouseProc","long","int;wparam;lparam") if ($RegMouseProc = 0) Then GUIDelete($MouseGui) Return SetError(3,0,0) EndIf $MouseHHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($RegMouseProc),$HMod) if ($MouseHHook = 0) Then GUIDelete($MouseGui) DllCallbackFree($RegMouseProc) Return SetError(4,0,0) EndIf Local $hBmp = 0 While 1 if $CaptureMouseTest = 2 Then GUIDelete($MouseGui) _Sleep(300) $hBmp = BitmapCreateFromPos($IMGE_L,$IMGE_T,$IMGE_W,$IMGE_H) ExitLoop EndIf WEnd If Not($ShowTaskBar) Then ShowTaskBar(True) _WinAPI_UnhookWindowsHookEx($MouseHHook) DllCallbackFree($RegMouseProc) Return $hBmp EndFunc Func CaptureLowLevelMouseProc($nCode,$wParam,$lParam) If $nCode < 0 Then _ Return _WinAPI_CallNextHookEx($MouseHHook, $nCode, $wParam, $lParam) Select Case $wParam == $WM_LBUTTONDOWN And $CaptureMouseTest = 0 $POINT = DllStructCreate($tagPOINT,$lParam) $START_X = DllStructGetData($POINT,1) $START_Y = DllStructGetData($POINT,2) $CaptureMouseTest = 1 Return 1 Case $wParam == $WM_MOUSEMOVE And $CaptureMouseTest = 1 $POINT = DllStructCreate($tagPOINT,$lParam) $MOVE_X = DllStructGetData($POINT,1) $MOVE_Y = DllStructGetData($POINT,2) if $START_X >= $MOVE_X Then $L = $MOVE_X $R = $START_X Else $R = $MOVE_X $L = $START_X EndIf if $START_Y >= $MOVE_Y Then $B = $START_Y $T = $MOVE_Y Else $T = $START_Y $B = $MOVE_Y EndIf Local $BorderSize = 3 $vL = ($L + $BorderSize) $vT = ($T + $BorderSize) $vR = ($R - $BorderSize) $vB = ($B - $BorderSize) $vW = ($vR - $vL) $vH = ($vB - $vT) Global $IMGE_L = $vL , $IMGE_T = $vT , $IMGE_W = $vW, $IMGE_H = $vH MouseDrawGuiRgn($BorderSize,$L,$T,$R,$B) Case $wParam == $WM_LBUTTONUP And $CaptureMouseTest = 1 $CaptureMouseTest = 2 Return 1 EndSelect Return _WinAPI_CallNextHookEx($MouseHHook, $nCode, $wParam, $lParam) EndFunc Func MouseDrawGuiRgn($BorderSize,$L,$T,$R,$B) Local $W = $R - $L , $H = $B - $T Local $hREG1 = _WinAPI_CreateRectRgn(0,0,$W,$H) Local $hREG2 = _WinAPI_CreateRectRgn($BorderSize,$BorderSize,($W - $BorderSize),($H - $BorderSize)) Local $hREG3 = _WinAPI_CreateRectRgn(0, 0, 0, 0) _WinAPI_CombineRgn($hREG3,$hREG1,$hREG2,$RGN_DIFF) _WinAPI_DeleteObject($hREG1) _WinAPI_DeleteObject($hREG2) _WinAPI_SetWindowRgn($MouseGui,$hREG3) _WinAPI_DeleteObject($hREG3) _WinAPI_SetWindowPos($MouseGui,0,$L,$T,$W,$H,BitOR($SWP_NOACTIVATE,$SWP_SHOWWINDOW)) EndFunc Func ChildsCapture($DialogWin,$Flage = 0,$ShowTaskBar = True) If Not($ShowTaskBar) Then ShowTaskBar(False) if ($DialogWin) Then $Return = GUISetState(@SW_HIDE,$DialogWin) if ($Return = 0) Then Return SetError(1,0,0) EndIf Local $HMod = _WinAPI_GetModuleHandle(0) if ($HMod = 0) Then Return SetError(2,0,0) $CaptureTest = 0 Switch $Flage Case 0 $RegProc = DllCallbackRegister("CaptureMouseProc","long","int;wparam;lparam") if ($RegProc = 0) Then Return SetError(3,0,0) $CapHHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($RegProc),$HMod) if ($CapHHook = 0) Then DllCallbackFree($RegProc) Return SetError(4,0,0) EndIf Case 1 $RegProc = DllCallbackRegister("CaptureKeyboardProc","long","int;wparam;lparam") if ($RegProc = 0) Then Return SetError(5,0,0) $CapHHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL,DllCallbackGetPtr($RegProc),$HMod) if ($CapHHook = 0) Then DllCallbackFree($RegProc) Return SetError(6,0,0) EndIf Case Else Return SetError(7,0,0) EndSwitch Local $hBmps = 0 While 1 $HwndsArray = WinFromPos() if Not @error Then $Windwo = $HwndsArray[0] $RootOwner = $HwndsArray[1] $IsChildWindo = $HwndsArray[2] $ViewerSize = GetWindoViewerSize($RootOwner) if Not @error Then DrawGuiRgn($ViewerSize) if ($CaptureTest) Then if WinExists($RgnGui) Then GUIDelete($RgnGui) _Sleep(300) EndIf $ChildWindwos = GetChildWindows($RootOwner) if IsArray($ChildWindwos) Then Local $hBmps[UBound($ChildWindwos) + 1] For $i = 0 To UBound($ChildWindwos) - 1 $ChildWindwo = $ChildWindwos[$i][0] $iViewerSize = GetWindoViewerSize($ChildWindwo) if Not @error Then $L = $iViewerSize[0] $T = $iViewerSize[1] $R = $iViewerSize[2] $B = $iViewerSize[3] $W = $R - $L $H = $B - $T $hBmp = BitmapCreateFromPos($L,$T,$W,$H) $hBmps[$i] = $hBmp Else $hBmps[$i] = 0 EndIf Next $L = $ViewerSize[0] $T = $ViewerSize[1] $R = $ViewerSize[2] $B = $ViewerSize[3] $W = $R - $L $H = $B - $T $hBmp = BitmapCreateFromPos($L,$T,$W,$H) $hBmps[$i] = $hBmp ExitLoop Else $L = $ViewerSize[0] $T = $ViewerSize[1] $R = $ViewerSize[2] $B = $ViewerSize[3] $W = $R - $L $H = $B - $T $hBmp = BitmapCreateFromPos($L,$T,$W,$H) $hBmps[0] = $hBmp ExitLoop EndIf EndIf EndIf EndIf WEnd If Not($ShowTaskBar) Then ShowTaskBar(True) _WinAPI_UnhookWindowsHookEx($CapHHook) DllCallbackFree($RegProc) Return $hBmps EndFunc Func AutoCapture($DialogWin,$Flage = 0,$ShowTaskBar = True) If Not($ShowTaskBar) Then ShowTaskBar(False) if ($DialogWin) Then $Return = GUISetState(@SW_HIDE,$DialogWin) if ($Return = 0) Then Return SetError(1,0,0) EndIf Local $HMod = _WinAPI_GetModuleHandle(0) if ($HMod = 0) Then Return SetError(2,0,0) $CaptureTest = 0 Switch $Flage Case 0 $RegProc = DllCallbackRegister("CaptureMouseProc","long","int;wparam;lparam") if ($RegProc = 0) Then Return SetError(3,0,0) $CapHHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($RegProc),$HMod) if ($CapHHook = 0) Then DllCallbackFree($RegProc) Return SetError(4,0,0) EndIf Case 1 $RegProc = DllCallbackRegister("CaptureKeyboardProc","long","int;wparam;lparam") if ($RegProc = 0) Then Return SetError(5,0,0) $CapHHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL,DllCallbackGetPtr($RegProc),$HMod) if ($CapHHook = 0) Then DllCallbackFree($RegProc) Return SetError(6,0,0) EndIf Case Else Return SetError(7,0,0) EndSwitch Local $hBmp = 0 While 1 $HwndsArray = WinFromPos() if Not @error Then $Windwo = $HwndsArray[0] $RootOwner = $HwndsArray[1] $IsChildWindo = $HwndsArray[2] $ViewerSize = GetWindoViewerSize($Windwo) if Not @error Then DrawGuiRgn($ViewerSize) if ($CaptureTest) Then if WinExists($RgnGui) Then GUIDelete($RgnGui) _Sleep(300) EndIf Local $L = $ViewerSize[0], $T = $ViewerSize[1] Local $R = $ViewerSize[2], $B = $ViewerSize[3] Local $W = $R - $L , $H = $B - $T $hBmp = BitmapCreateFromPos($L,$T,$W,$H) ExitLoop EndIf EndIf EndIf WEnd If Not($ShowTaskBar) Then ShowTaskBar(True) _WinAPI_UnhookWindowsHookEx($CapHHook) DllCallbackFree($RegProc) Return $hBmp EndFunc Func DrawGuiRgn($ViewerSize) if UBound($ViewerSize) < 4 Then Return False Local $L = $ViewerSize[0], $T = $ViewerSize[1] Local $R = $ViewerSize[2], $B = $ViewerSize[3] $RgnGui = GUICreate("",0,0,0,0,BitOR($WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS) , _ BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE,$DS_MODALFRAME)) GUISetBkColor(0xFF0000,$RgnGui) Local $W = $R - $L , $H = $B - $T Local $hREG1 = _WinAPI_CreateRectRgn(0,0,$W,$H) Local $hREG2 = _WinAPI_CreateRectRgn(4,4,$W - 4,$H - 4) Local $hREG3 = _WinAPI_CreateRectRgn(0, 0, 0, 0) _WinAPI_CombineRgn($hREG3,$hREG1,$hREG2,$RGN_DIFF) _WinAPI_DeleteObject($hREG1) _WinAPI_DeleteObject($hREG2) _WinAPI_SetWindowRgn($RgnGui,$hREG3) _WinAPI_DeleteObject($hREG3) _Sleep(300) _WinAPI_SetWindowPos($RgnGui,0,$L,$T,$W,$H,BitOR($SWP_NOACTIVATE,$SWP_SHOWWINDOW)) _Sleep(300) GUIDelete($RgnGui) _Sleep(300) Return True EndFunc Func GetWindoViewerSize($Windwo) $Rect = _WinAPI_GetWindowRect($Windwo) if @error Then Return SetError(1,0,0) Local $Left = DllStructGetData($Rect,1) , $Top = DllStructGetData($Rect,2) Local $Right = DllStructGetData($Rect,3) , $Bottom = DllStructGetData($Rect,4) Local $jRight = @DesktopWidth , $jBottom = @DesktopHeight if $Bottom > $jBottom Then $Bottom = $jBottom If $Right > $jRight Then $Right = $jRight if $Left < 0 Then $Left = 0 if $Top < 0 Then $Top = 0 if ($Right - $Left) <= 0 Or ($Bottom - $Top) <= 0 Then Return SetError(2,0,0) Local $IsChildWindwoOfTaskBar = False $QChildWindwos = GetChildWindows($TrayWnd) if Not IsArray($QChildWindwos) Then Return SetError(3,0,0) For $i = 0 To UBound($QChildWindwos) - 1 if $QChildWindwos[$i][0] = $Windwo Then $IsChildWindwoOfTaskBar = True Next if (Not($IsChildWindwoOfTaskBar) And $Windwo <> $TrayWnd And $Windwo <> $ButtonWnd) Then $Rect = _WinAPI_GetWindowRect($TrayWnd) if @error Then Return SetError(4,0,0) $iLeft = DllStructGetData($Rect,1) $iTop = DllStructGetData($Rect,2) $iRight = DllStructGetData($Rect,3) $iBottom = DllStructGetData($Rect,4) Select Case $iLeft = 0 And $iBottom = @DesktopHeight And $iRight = @DesktopWidth if ($Bottom > $iTop) Then $Bottom = $iTop Case $iLeft = 0 And $iTop = 0 And $iRight = @DesktopWidth if ($Top < $iBottom) Then $Top = $iBottom Case $iLeft = 0 And $iTop = 0 And $iBottom = @DesktopHeight if ($Left < $iRight) Then $Left = $iRight Case $iTop = 0 And $iRight = @DesktopWidth And $iBottom = @DesktopHeight if ($Right > $iLeft) Then $Right = $iLeft EndSelect if ($Right - $Left) <= 0 Or ($Bottom - $Top) <= 0 Then Return SetError(5,0,0) EndIf Local $ViewerSize[4] $ViewerSize[0] = $Left $ViewerSize[1] = $Top $ViewerSize[2] = $Right $ViewerSize[3] = $Bottom Return $ViewerSize EndFunc Func CaptureMouseProc($nCode,$wParam,$lParam) If $nCode < 0 Then _ Return _WinAPI_CallNextHookEx($CapHHook, $nCode, $wParam, $lParam) if ($wParam == $WM_LBUTTONDOWN And $CaptureTest = 0) Then $CaptureTest = 1 Return 1 EndIf if ($wParam == $WM_LBUTTONUP And $CaptureTest = 1) Then Return 1 Return _WinAPI_CallNextHookEx($CapHHook, $nCode, $wParam, $lParam) EndFunc Func CaptureKeyboardProc($nCode,$wParam,$lParam) If $nCode < 0 Then _ Return _WinAPI_CallNextHookEx($CapHHook, $nCode, $wParam, $lParam) if ($wParam = $WM_KEYDOWN And $CaptureTest = 0) Then $CaptureTest = 1 Return 1 EndIf if ($wParam == $WM_KEYUP And $CaptureTest = 1) Then Return 1 Return _WinAPI_CallNextHookEx($CapHHook, $nCode, $wParam, $lParam) EndFunc Func ShowTaskBar($BOOL) if ($BOOL = True) Then _WinAPI_ShowWindow($TrayWnd,@SW_SHOW) if ($ButtonWnd) Then _WinAPI_ShowWindow($ButtonWnd,@SW_SHOW) Else _WinAPI_ShowWindow($TrayWnd,@SW_HIDE) if ($ButtonWnd) Then _WinAPI_ShowWindow($ButtonWnd,@SW_HIDE) EndIf EndFunc Func WinFromPos() Local $MoPos = 0 , $HwndsArray[3] While Not IsArray($MoPos) $MoPos = MouseGetPos() WEnd $tPoint = DllStructCreate("int;int") DllStructSetData($tPoint,1,$MoPos[0]) DllStructSetData($tPoint,2,$MoPos[1]) $PointHwnd = _WinAPI_WindowFromPoint($tPoint) if ($PointHwnd = 0) Then Return SetError(1,0,0) $RootOwner = _WinAPI_GetAncestor($PointHwnd,$GA_ROOTOWNER) if ($RootOwner = 0) Then Return SetError(2,0,0) $ChildWindwos = GetChildWindows($RootOwner) if IsArray($ChildWindwos) Then For $i = UBound($ChildWindwos) - 1 To 0 Step - 1 $ML = $MoPos[0] $MT = $MoPos[1] $ChildWindwo = $ChildWindwos[$i][0] $L = $ChildWindwos[$i][1] $T = $ChildWindwos[$i][2] $W = $ChildWindwos[$i][3] $H = $ChildWindwos[$i][4] if ($ML >= $L ) And ($ML <= ($L + $W)) _ And ($MT >= $T ) And ($MT <= ($T + $H)) Then $HwndsArray[0] = $ChildWindwo $HwndsArray[1] = $RootOwner $HwndsArray[2] = True ; IsChildWindo Return $HwndsArray EndIf Next EndIf $HwndsArray[0] = $PointHwnd $HwndsArray[1] = $RootOwner $HwndsArray[2] = False ; IsChildWindo Return $HwndsArray EndFunc Func GetChildWindows($HWND) $vChildWindwos = 0 $RegChildProc = DLLCallbackRegister("EnumChildProc","int","hwnd;int") $ChildProcPtr = DllCallbackGetPtr($RegChildProc) DllCall("user32.dll","BOOL","EnumChildWindows","hwnd",$HWND,"ptr",$ChildProcPtr,"int",0) DllCallbackFree($RegChildProc) Return $vChildWindwos EndFunc Func EnumChildProc($HWND,$lParam) Local $EndTest = False For $i = 0 To UBound($vChildWindwos) - 1 if $HWND = $vChildWindwos[$i][0] Then $EndTest = True Next if $EndTest = False Then if Not IsArray($vChildWindwos) Then Dim $vChildWindwos[1][5] Else ReDim $vChildWindwos[UBound($vChildWindwos) + 1][5] EndIf $Rect = _WinAPI_GetWindowRect($HWND) $Left = DllStructGetData($Rect,1) $Top = DllStructGetData($Rect,2) $Right = DllStructGetData($Rect,3) $Bottom = DllStructGetData($Rect,4) $L = $Left $T = $Top $W = $Right - $Left $H = $Bottom - $Top $vChildWindwos[UBound($vChildWindwos) - 1][0] = $HWND $vChildWindwos[UBound($vChildWindwos) - 1][1] = $L $vChildWindwos[UBound($vChildWindwos) - 1][2] = $T $vChildWindwos[UBound($vChildWindwos) - 1][3] = $W $vChildWindwos[UBound($vChildWindwos) - 1][4] = $H Return True Else Return False EndIf EndFunc Func BitmapCreateFromPos($L,$T,$W,$H) $DC = _WinAPI_GetWindowDC(0) $CompatibleDC = _WinAPI_CreateCompatibleDC($DC) $hBmp = _WinAPI_CreateCompatibleBitmap($DC,$W,$H) _WinAPI_SelectObject($CompatibleDC,$hBmp) _WinAPI_BitBlt($CompatibleDC,0,0,$W,$H,$DC,$L,$T,$SRCCOPY) _WinAPI_ReleaseDC(0,$DC) _WinAPI_DeleteDC($CompatibleDC) Return $hBmp EndFunc Func _Sleep($Time) Local $begin = TimerInit() While TimerDiff($begin) < $Time WEnd EndFunc1 point -
Picture of a modified calltip in Scite Au3 API Updater This is the release of the Au3 API Updater version 2. Version 1 was released to public some years ago and it was very simple with just the "Check: Boolean, @error" type of stuff. Later, I decided of a new idea to implement a more expressive modification of the AutoIt inbuilt function calltips. The ini file method was limited in detail and not very readable for a human being. So I chose a csv method to do the storing of data needed. More information is added to the calltips which can be a concern as it takes more attention to read the detail of them. One advantage though is that it may help some people from referring to the help file too much. So a compromise had to be accepted though I did try to minimize wording as was possible. Scite allows the use of escape characters such as n t and some others in calltips though the interest in the others is not explored for this release. This is something that version 1 did not have access to. This opened up ideas to make better use of calltips with more then 2 lines. The n is for creating new lines while ntt is inserted inline for very long lines to create a wrap of text e.g. create new line, add 2 tabs and then continue with the line of text. I did choose to put a space after the last t as you may see that the t is not part of the word following it. It is important to have the property setting of calltip.*.use.escapes=1 in Scite. This allows for escaped n and other escaped characters in calltips. If you want to view and save the csv file in Scite then make sure you use the property setting strip.trailing.spaces=0 as Scite may have have it set to 1. The csv file is tab delimited and a setting of 1 will remove the tabs on the function name lines if saved. A spreadsheet program may help fix the formatting by importing it set as tab delimited with no quotes or other delimiter settings. Saving the csv with LibreOffice helps to correct them as I have tested. The script can also wrap long lines in the STD UDFs. Some inbuilt functions such as ControlCommand, which has many variations, is exempt from calltip modification except for wrapping long lines. The script does not check the function parameters to determine calltips to assign to them. You may notice in the script that I create a filter array. These filtered items are treated different compared to the other inbuilt functions. These filtered functions will keep the original descriptions. How to use Au3 API Updater Set calltip.*.use.escapes=1 in Scite. * Set strip.trailing.spaces=0 in Scite. * Extract zip file with folder structure to e.g. Desktop. Copy au3.api from @ProgramFilesDirAutoIt3Sciteapi into the folder on your Desktop. Run the script Au3_API_Updater.au3 in the Desktop folder and it may take as little as a second to finish the task. The au3.api will be modified with a backup made of the original set to .bak extension. The backup file allows you to rerun the scipt without the copy task needing to be repeated. You can then append the original in the api directory with a bak extension and then copy the modified au3.api file back into the api directory. Changing tabs in Scite or restarting Scite will load/reload the new calltips. * = User Options will be a reasonable place to add the Scite setting into. strip.trailing.spaces=0 is only needed if you edit and save the csv file in Scite. Download Au3 API Updater AutoIt 3.3.8.1 au3_api_updater.zip AutoIt 3.3.10.2 au3_api_updater.zip The requirement for using escaped characters in Scite calltips is version 3.04 or better. More can be found on the homepage that I setup for it here. A lua file for handling script directory calltips etc. can be found on the homepage. Cheers Edit Uploaded new zip file for use with AutoIt 3.3.10.2.1 point
-
well sorry but i just reply on comments from others so i can't help it:O can't just ignore them can i?1 point