Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/07/2014 in all areas

  1. Here is a simple capture tool, using the great Mark_Rect and _GUICreateInvRect functions by Melba23 (not sure if it's him, though). It will capture a desired region and put the image in the clipboard, nothing else. However, if you want it to save the capture, see post >#7. The purpose of this script is to paste your captures into Word (or any other advanced text editor) to make procedures. I have added some extra features like tooltips to show current mouse pos and rect size. I can add some others like drawing the capture time, on demand. How to use it ? Press "PrintScreen" or "Ctrl + Shift + 3" and voila. NB : It preserves the screen layout, meaning if you have for example opened a contextmenu this last will be still visible on your captured image; which is the main reason of why I made this script. Requirements : AutoIt v3.3.9.12+ (ternary operator) Click for a preview : ; By FireFox, 2014 ; Version : 1.4 #include <WindowsConstants.au3> #include <Misc.au3> #include <WinAPI.au3> #include <ScreenCapture.au3> #include <ClipBoard.au3> #include <ColorConstants.au3> #include <Constants.au3> ; Settings Global $_fShowMousePos = True, $_fShowRectSize = True, $_fHideDesktop = False, $_fHideTaskBar = False If HotKeySet("{PRINTSCREEN}", "Example") = 0 Then MsgBox($MB_SYSTEMMODAL, "", "Could not set the hotkey !") Exit 1 EndIf HotKeySet("^+{3}", "Example") ;for Windows under a MacBook lacking of a PrintScreen key (yes... me) While 1 Sleep(10000) ;10 sec WEnd Func Example() Local $iX1 = 0, $iY1 = 0, $iX2 = 0, $iY2 = 0 Local $hGUICapture = 0 Mark_Rect($hGUICapture, $iX1, $iY1, $iX2, $iY2) Local $hBitmap = _ScreenCapture_CaptureWnd("", $hGUICapture, $iX1, $iY1, $iX2, $iY2, False) GUIDelete($hGUICapture) Local $fOpenCb = _ClipBoard_Open(0) If Not $fOpenCb Then MsgBox($MB_SYSTEMMODAL, "", "Could not open the clipboard !") Return False EndIf _ClipBoard_Empty() Local $hBitmap3 = _WinAPI_CopyImage($hBitmap, 0, 0, 0, BitOR($LR_COPYDELETEORG, $LR_COPYRETURNORG)) _WinAPI_DeleteObject($hBitmap) _ClipBoard_SetDataEx($hBitmap3, $CF_BITMAP) _ClipBoard_Close() _WinAPI_DeleteObject($hBitmap3) EndFunc ;==>Example Func Mark_Rect(ByRef $hGUICapture, ByRef $iX1, ByRef $iY1, ByRef $iX2, ByRef $iY2) Local $iX_Pos = 0, $iY_Pos = 0, $iTemp = 0, $iWidth = 0, $iHeight = 0 Local $hMask_1 = 0 Local $hWnd = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local $aWgp = WinGetPos($hWnd) If $_fHideDesktop Then ControlHide($hWnd, "", "[CLASS:SysListView32; INSTANCE:1]") EndIf If $_fHideTaskBar Then WinSetState("[CLASS:Shell_TrayWnd]", "", @SW_HIDE) WinSetState("[CLASS:Button]", "", @SW_HIDE) EndIf Local $hBitmap = _ScreenCapture_Capture("", $aWgp[0], $aWgp[1], $aWgp[2], $aWgp[3]) Local $aSize[2] = [$aWgp[2], $aWgp[3]] $aWgp = 0 $hGUICapture = GUICreate("", $aSize[0], $aSize[1], 0, 0, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_APPWINDOW, $WS_EX_TOPMOST)) GUISetCursor($IDC_CROSS, 1, $hGUICapture) If $giGDIPRef = 0 Then _GDIPlus_Startup() EndIf Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUICapture) Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) _WinAPI_DeleteObject($hBitmap) WinSetTrans($hGUICapture, "", 0) GUISetState(@SW_SHOWNOACTIVATE, $hGUICapture) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) If $giGDIPRef > 1 Then _GDIPlus_Shutdown() EndIf WinSetTrans($hGUICapture, "", 255) If $_fHideTaskBar Then WinSetState("[CLASS:Button]", "", @SW_SHOWNOACTIVATE) WinSetState("[CLASS:Shell_TrayWnd]", "", @SW_SHOWNOACTIVATE) EndIf If $_fHideDesktop Then ControlShow($hWnd, "", "[CLASS:SysListView32; INSTANCE:1]") EndIf Local $hGUIRect = GUICreate("", $aSize[0], $aSize[1], 0, 0, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUISetBkColor($COLOR_BLACK) GUISetCursor($IDC_CROSS, 1, $hGUIRect) _GUICreateInvRect($hGUIRect, $aSize, $hMask_1, 0, 0, 1, 1) WinSetTrans($hGUIRect, "", 75) GUISetState(@SW_SHOWNOACTIVATE, $hGUIRect) Local $hUserDLL = DllOpen("user32.dll") Local $aMgp = 0 Local $fExitLoop = False ; Wait until mouse button pressed While Not _IsPressed("01", $hUserDLL) And Not $fExitLoop If $_fShowMousePos Then $aMgp = MouseGetPos() ToolTip("x: " & $aMgp[0] & ", y: " & $aMgp[1], _ $aMgp[0] + ($aMgp[0] > 100 ? -95 : 10), _ $aMgp[1] + ($aMgp[1] > 50 ? -35 : 10)) EndIf Sleep(10) If _IsPressed("1B", $hUserDLL) Then $fExitLoop = True WEnd If $_fShowMousePos Then ToolTip("") EndIf ; Get first mouse position $aMgp = MouseGetPos() $iX1 = $aMgp[0] $iY1 = $aMgp[1] ; Draw rectangle while mouse button pressed While _IsPressed("01", $hUserDLL) And Not $fExitLoop $aMgp = MouseGetPos() ; Set in correct order if required If $aMgp[0] < $iX1 Then $iX_Pos = $aMgp[0] $iWidth = $iX1 - $aMgp[0] Else $iX_Pos = $iX1 $iWidth = $aMgp[0] - $iX1 EndIf If $aMgp[1] < $iY1 Then $iY_Pos = $aMgp[1] $iHeight = $iY1 - $aMgp[1] Else $iY_Pos = $iY1 $iHeight = $aMgp[1] - $iY1 EndIf _GUICreateInvRect($hGUIRect, $aSize, $hMask_1, $iX_Pos, $iY_Pos, $iWidth, $iHeight) If $_fShowRectSize Then ToolTip("w: " & Abs($aMgp[0] - $iX1) & ", h: " & Abs($aMgp[1] - $iY1), _ $aMgp[0] + ((($aMgp[0] > $aSize[0] - 100 Or ($aMgp[0] - $iX1 < 0 And $aMgp[1] - $iY1 < 0)) And $aMgp[0] > 100) ? -95 : 10), _ $aMgp[1] + ((($aMgp[1] > $aSize[1] - 40 Or ($aMgp[0] - $iX1 < 0 And $aMgp[1] - $iY1 < 0)) And $aMgp[1] > 40) ? -35 : 10)) EndIf Sleep(10) If _IsPressed("1B", $hUserDLL) Then $fExitLoop = True WEnd If $_fShowRectSize Then ToolTip("") EndIf _WinAPI_DeleteObject($hMask_1) ; Get second mouse position $iX2 = $aMgp[0] $iY2 = $aMgp[1] ; Set in correct order if required If $iX2 < $iX1 Then $iTemp = $iX1 $iX1 = $iX2 $iX2 = $iTemp EndIf If $iY2 < $iY1 Then $iTemp = $iY1 $iY1 = $iY2 $iY2 = $iTemp EndIf GUIDelete($hGUIRect) DllClose($hUserDLL) EndFunc ;==>Mark_Rect Func _GUICreateInvRect($hWnd, $aSize, ByRef $hMask_1, $iX, $iY, $iW, $iH) Local $hMask_2 = 0, $hMask_3 = 0, $hMask_4 = 0 $hMask_1 = _WinAPI_CreateRectRgn(0, 0, $aSize[0], $iY) $hMask_2 = _WinAPI_CreateRectRgn(0, 0, $iX, $aSize[1]) $hMask_3 = _WinAPI_CreateRectRgn($iX + $iW, 0, $aSize[0], $aSize[1]) $hMask_4 = _WinAPI_CreateRectRgn(0, $iY + $iH, $aSize[0], $aSize[1]) _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_2, 2) _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_3, 2) _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_4, 2) _WinAPI_DeleteObject($hMask_2) _WinAPI_DeleteObject($hMask_3) _WinAPI_DeleteObject($hMask_4) _WinAPI_SetWindowRgn($hWnd, $hMask_1, 1) EndFunc ;==>_GUICreateInvRect Attached the same script as above. (Previous downloads : 47) Br, FireFox. Simple Capture tool.au3
    1 point
  2. kram, Perhaps this might help: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StringSize.au3> $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput("", 10, 10, 20, 20) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord Local $iCode = BitShift($wParam, 16) ;HiWord If $iIDFrom = $cInput And $iCode = $EN_CHANGE Then $aSize = _StringSize(GUICtrlRead($cInput)) GUICtrlSetPos($cInput, 10, 10, $aSize[2] + 15) EndIf EndFunc ;==>_WM_COMMAND You can find the StringSize UDF in my sig. M23
    1 point
  3. Valiante

    Unable to expand a link

    I would really like to help, but using the html you've given, I still can't recreate the screenshot in your first post. I'm afraid I don't have time to play around with the html to get an expandable collapsed DIV in order to recreate your issue. So until we get the html in its entirety, then I'm sorry, help won't be that forthcoming.
    1 point
  4. depending on your encryption technique, you may have to break long strings into segments, encrypt each, then tie the string back together. One of the UDFs I found on this forum has a limit to 16 characters, which makes it more difficult to deal with, but once the programs are written to encrypt and decrypt, the length of string really doesn't matter too much (though there will be more processing time used, so balance things as best you can). It is actually not a bad idea to keep strings small to encrypt then tie back together in a 'bundle' - it makes it a degree of difficulty harder for someone to decrypt it. I would further suggest you vary the length of the breaks and rarely (if ever) break out a key pieces of data to encrypt by itself (as discussed in the other thread, say, for instance, you are going to grab the UUID, drive info, motherboard, etc. of a computer, you should tie them together, then break in various locations, encrypt each and put it all back into one string.) Example (not all the code, but the comments!) ; gather data that we want to encrypt (UUID, drive info, motherboard in this example) ; get UUID $UUID = (function to get the UUID) ; get disk drive info $DriveInfo = (function to get the drive info) ; get computer board number $CompBoardNo = (function to get that data) Now, say we have $UUID (10 characters) $DriveInfo (15 characters) $CompBoardNo (8 characters) ; put them all together in one string $sStringToEncrypt = $UUID & $DriveInfo & $CompBoardNo ; break the string into small groups (if you make this various sizes, you will be more 'secure' (somewhat more difficult to decrypt/understand) For this example, let's divide it into 4 parts(i.e., we decided not to use the above option - see how it is up to you how 'difficult' you want to make things and it will give a different result!) There's 33 characters total, so 4 parts would be 3 with 8 and one with 9 characters (already different lengths) ; encrypt each part $eString1 = _my_encrypt_function($sString1_toencrypt) $eString2 = _my_encrypt_function($sString2_toencrypt) $eString3 = _my_encrypt_function($sString3_toencrypt) $eString4 = _my_encrypt_function($sString4_toencrypt) ; put them back together $eStringToProcessFurther = $eString1 & $eString2 & $eString3 & $eString4 to decrypt, just reverse the process.
    1 point
  5. I would recommend AutoIt in some cases. In your case GreaseMonkey is better. It depends on just what you want to do. Think of it as you have a toolbox full of tools. Would you use a pair of pliers to drive a nail? You could but a hammer is better.
    1 point
  6. v1.5 released Fixed the bug that was preventing the list item to be inserted from the mouseclicks.
    1 point
  7. JohnOne

    WinHTTP functions

    Yes trancexx, and hurry up about it. Brejack has'nt got all day you know.
    1 point
  8. trancexx

    WinHTTP functions

    okely-dokely Just remember that recycling cans is important ...and other stuff like that. Go now and make us all proud.
    1 point
×
×
  • Create New...