Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/31/2016 in all areas

  1. I found this a while back and was going to use it for a project, but never did. It should help. #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include <ScreenCapture.au3> #Include <Misc.au3> Global $iX1, $iY1, $iX2, $iY2, $aPos, $sMsg, $sBMP_Path ; Create GUI $hMain_GUI = GUICreate("Select Rectangle", 240, 50) $hRect_Button = GUICtrlCreateButton("Mark Area", 10, 10, 80, 30) $hCancel_Button = GUICtrlCreateButton("Cancel", 150, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hCancel_Button Exit Case $hRect_Button GUISetState(@SW_HIDE, $hMain_GUI) Mark_Rect() EndSwitch WEnd Func Mark_Rect() Local $aMouse_Pos, $hMask, $hMaster_Mask, $iTemp Local $UserDLL = DllOpen("user32.dll") ; Create transparent GUI with Cross cursor $hCross_GUI = GUICreate("Test", @DesktopWidth, @DesktopHeight - 20, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) WinSetTrans($hCross_GUI, "", 2) GUISetState(@SW_SHOW, $hCross_GUI) GUISetCursor(3, 1, $hCross_GUI) Global $hRectangle_GUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetBkColor(0xFF0000) ; Wait until mouse button pressed While Not _IsPressed("01", $UserDLL) Sleep(10) WEnd ; Get first mouse position $aMouse_Pos = MouseGetPos() $iX1 = $aMouse_Pos[0] $iY1 = $aMouse_Pos[1] ; Draw rectangle while mouse button pressed While _IsPressed("01", $UserDLL) $aMouse_Pos = MouseGetPos() $hMaster_Mask = _WinAPI_CreateRectRgn(0, 0, 0, 0) $hMask = _WinAPI_CreateRectRgn($iX1, $aMouse_Pos[1], $aMouse_Pos[0], $aMouse_Pos[1] + 1) ; Bottom of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX1, $iY1, $iX1 + 1, $aMouse_Pos[1]) ; Left of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX1 + 1, $iY1 + 1, $aMouse_Pos[0], $iY1) ; Top of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($aMouse_Pos[0], $iY1, $aMouse_Pos[0] + 1, $aMouse_Pos[1]) ; Right of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) ; Set overall region _WinAPI_SetWindowRgn($hRectangle_GUI, $hMaster_Mask) If WinGetState($hRectangle_GUI) < 15 Then GUISetState() Sleep(10) WEnd ; Get second mouse position $iX2 = $aMouse_Pos[0] $iY2 = $aMouse_Pos[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($hRectangle_GUI) GUIDelete($hCross_GUI) DllClose($UserDLL) EndFunc ;==>Mark_Rect
    1 point
  2. BrewManNH

    A wrapper for isql.exe

    This thread is nearly 12 years old, I'm not surprised the link is dead after that amount of time.
    1 point
  3. willichan

    Mapped Drive

    Try using just DriveMapAdd("Z:", "\\server\folder\folder") leaving off the trailing \ from the path.
    1 point
  4. _SendMessage ( $hWnd, $iMsg [, $wParam = 0 [, $lParam = 0 [, $iReturn = 0 [, $wParamType = "wparam" [, $lParamType = "lparam" [, $sReturnType = "lresult"]]]]]] ) Now you're sending wParam of 1, lParam of 19, and your return value is 14. Usually, in .net, using 'l' to start a variable name is going to make it type Long, 'w' is Word. You need to convert your x and y coordinates into a long value. You can do that by using the _WinApi_MakeLong function. I'd suggest working with some windows messages before you try sending them, so you can better understand what you're doing. _WinApi_LoWord($iLong) ; Returns the low word of a longword value _WinApi_HiWord($iLong) ; Returns the high word of a longword value _WinAPI_MakeLong($iLo, $iHi) ; Returns a long int value from two int values These are functions you will encounter, and should have used, when working with windows messages.
    1 point
  5. For $i = 0 To UBound($aUserAccountsDB, $UBOUND_ROWS) - 1
    1 point
  6. Hi. You can do something like this. #include <IE.au3> Local $oIE = _IECreate("http://mixupload.com/en/styles/house") Local $aArray = _IEGetObjByClass($oIE, "fltr_button switcher all right", "a") Local $oAll = $aArray[1] _IEAction($oAll,"click") Func _IEGetObjByClass($oIE, $sClass, $sTag = "*") Local $aRet[1] = [0] Local $allHTMLTags = _IETagNameGetCollection($oIE, $sTag) For $o In $allHTMLTags If IsString($o.className) And $o.className = $sClass Then $aRet[0] += 1 ReDim $aRet[$aRet[0] + 1] $aRet[$aRet[0]] = $o EndIf Next Return $aRet EndFunc ;==>_IEGetObjByClass Saludos
    1 point
  7. Something like that here maybe? #include <GDIPlus.au3> #include <GuiConstantsEx.au3> _GDIPlus_Startup() Global $iDialog_Width = 1280 Global $iDialog_Depth = 720 Global $blueness = 0xff0066ff Global Const $hGUI = GUICreate("Test", $iDialog_Width, $iDialog_Depth) Global Const $iPic = GUICtrlCreatePic("", $iDialog_Width / 4, $iDialog_Depth / 4, $iDialog_Width / 2, $iDialog_Depth / 2), $hPic = GUICtrlGetHandle($iPic) GUISetState() Global $iCounter = 0 Do _DisplayProgress($iCounter, "c:\Windows\SysWOW64\Resources\", $iPic) $iCounter += 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() _GDIPlus_Shutdown() Exit EndSwitch Until False Func _DisplayProgress($iNumber, $sPath, $iCtrl, $iColorBorder = 0xff0066ff, $iColorText = 0xFFFFFFFF, $iColorCounter = 0xFFFF0000, $iColorBg = 0xFF808080, $iBorder_Size = 16) Local $aSize = ControlGetPos("", "", $iCtrl) If @error Then Return SetError(1, 0, 0) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($aSize[2], $aSize[3]) Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 2) _GDIPlus_GraphicsClear($hGfx, $iColorBg) Local Const $hPath = _GDIPlus_PathCreate() Local Const $hPen_Border = _GDIPlus_PenCreate($iColorBorder, $iBorder_Size), $hBrush_Txt = _GDIPlus_BrushCreateSolid($iColorText), _ $hBrush_Counter = _GDIPlus_BrushCreateSolid($iColorCounter) Local Const $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI"), $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) Local $tLayout = _GDIPlus_RectFCreate(0, 0, $aSize[2], $aSize[3]) _GDIPlus_PathAddString($hPath, "Loading " & StringFormat(" %" & StringLen($iNumber)& "i ", $iNumber) & " thumbnail(s) from " & @CRLF & $sPath, $tLayout, $hFamily, 0, 24, $hFormat) _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush_Txt) _GDIPlus_GraphicsDrawRect($hGfx, $iBorder_Size, $iBorder_Size, $aSize[2] - 2 * $iBorder_Size, $aSize[3] - 2 * $iBorder_Size, $hPen_Border) Local Const $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_DeleteObject(GUICtrlSendMsg($iCtrl, 0x0172, $IMAGE_BITMAP, $hHBitmap)) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_PenDispose($hPen_Border) _GDIPlus_BrushDispose($hBrush_Txt) _GDIPlus_BrushDispose($hBrush_Counter) _GDIPlus_PathDispose($hPath) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBitmap) EndFunc Tested only on Win10 x64.
    1 point
  8. Quantifiers (or repetition specifiers) 1 or more (infinity) is {1,} or + 0 or more (infinity) is {0,} or * A Regular Expression (RE). pattern starts trying to match the test string from left to right. Using the test string "123123123456123" and the RE pattern "(123)(.{1,6}456)", or "(123)(.+456)", Starting at the far left of the test string the first "123" match the start of the RE pattern. Continuing to the right of the test string if there is 1 to 6, or many characters before "456", the entire RE pattern matches. When the RE pattern "(123)(.{1,5}456)" is used, the first "123" does not match the entire RE pattern. Because after "123" and counting 1 to 5 characters there is no "456". So continuing searching in the right direction along the test string the RE pattern tries to match again. The second "123" matches and there are 3 characters before "456" - an RE pattern complete match. The search continues on from the "6" in "456" without a complete RE pattern match (only 3 characters left). So the data in the test string that matches the first capture group of the RE pattern, "(123)" is replaced with "abc". The data in the test string that matches the second capture group of the RE pattern, "(.{1,5}456)" is back-referenced "$2 " or "${2}" or "\2", which, from the test string would be "123456". The position of the opening bracket of a capture group from left to right in the RE pattern defines its back-reference number. Example - In the RE pattern "(123)(.{1,5}456)", the "(.{1,5}456)" part has the second open bracket,"(" when searching left to right. So what "(.{1,5}456)" matches in the test string is what can be back-referenced, or what is in the variable "$2", namely "123456".
    1 point
  9. Hi Deye, I see no reason why your implementation wouldn't work in principle (or in practice). Looking at Morthawt's codes, there's an inputbox query at startup (name for generator, serial key for checker); I'm not clear how you would wish to implement that; presumably it would be too tedious for a user to have to type in a serial key every time they use your software, but you don't want to store this serial key on a user's machine, but (re)generate it on the fly. You could opt to use the generator function itself, and have the user enter their registered name at startup. Alternatively, you could use multiple keys, of which the (for example registry-stored) serial code would be just one, and username and, say, motherboard ID being other possible candidates to include. The way to do this is to edit MCFinclude.au3 to incorporate all necessary functions to generate/check the serial code. Now it's crucial where you put these: above or inside #region Encryption1: content will be obfuscated only (if obfuscation is switched on); inside #region Encryption2 (above function MCF_Init()): content will be obfuscated and fixed-key encrypted (independent of $CCkey[...] contents); this is the only type of encryption that will work (see below); below #region Encryption2 (that is, anywhere below function MCF_Init()): this will not work! Another member ran into this gotcha earlier in this thread. Doing this would create a circular argument (literally) of the code needing its own unencrypted content in order to decrypt that same content. So do not paste any of your key-generating code at the end of MCFinclude.au3, but always above/inside #region Encryption2, and above its last function MCF_Init() which is used as marker for the end of that #region! If you do decide to go with user query at startup, an empty key definition will trigger a password inputbox in MCFinclude (see just below $CCkey definitions); you could edit that and wrap whatever InputBox returns inside your own call to your own serial-generating function, so its return is stored in $CCkey[1]. Once MCFinclude works the way you want it, you can then quickly generate multiple software copies for individual users using only CodeCrypter (without having to edit MCFinclude.au3 each time) by providing a user-specific, expected serial code (twice) in the key definition box (under Tab Encrypt). That will then be the actual encryption key. This can also be automated through CodeCrypter's command-line options (haven't tested that bit extensively though). For a valid user's entry at startup, the same serial would be produced by Morthawt's functions to be used for decrypting your script at runtime. Regarding your second question about stripped code, doubtless you already know that CodeCrypter will by default do that for you, but if you wish to have full control yourself, you can of course generate a single .au3 file with all #includes incorporated beforehand. If that runs okay, and CodeScanner reports no issues (so all required constants are present), then there should be no problem Codecrypting that script either (in that case there will be just a single metacode file: MCF1.txt, and building MCF0.au3 should be really quick). You can test a BackTranslated version (without encryption or obfuscation or any other alterations) first, if you're not sure. Hope this clarifies matters. EDIT: actually, just remembered that CodeCrypter does expect MCFinclude to be a separate #include file when encryption is switched on. So you would either have to disable that check inside CodeCrypter, or keep MCFinclude as your only external #include file, while stripping the rest.
    1 point
  10. change your func _populate to: Func _populate() Global $Services = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") Global $ServicesList = $Services.ExecQuery("SELECT * FROM Win32_Service") If IsObj($ServicesList) then _GUICtrlListView_BeginUpdate($ListView1) _GUICtrlListView_BeginUpdate($ListView2) _GUICtrlListView_DeleteAllItems($ListView1) _GUICtrlListView_DeleteAllItems($ListView2) For $Services in $ServicesList if $Services.State = "Running" Then GUICtrlCreateListViewItem( $Services.DisplayName & "|" & $Services.Name & "|" & $Services.State , $ListView1) Else GUICtrlCreateListViewItem( $Services.DisplayName & "|" & $Services.Name & "|" & $Services.State , $ListView2) EndIf Next _GUICtrlListView_EndUpdate($ListView1) _GUICtrlListView_EndUpdate($ListView2) EndIf EndFunc
    1 point
  11. Use the Opt("ExpandVarStrings", 1) function to replace variables. Opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand $CurrentMatchUsername = "Dgameman1" $CurrentMatchUsername = @UserName ; just to test with own osername $picklineText = "$CurrentMatchUsername$!! Hey, hi!" FileWrite("C:\Users\$CurrentMatchUsername$\Desktop\test.txt", $picklineText)
    1 point
  12. JohnOne

    get Mouse Pos in Rect

    ToolTip($hPos[0] - $iPosX & " , " & $hPos[1] - $iPosY)
    1 point
  13. Then please explain the set of strict rules governing such processing in plain english, clearly and rigorously. Because the two examples in your last post seem contradictory: in the first you seem to replace only the first occurence of 123 appearing after the first non-empty string not containing 123, but you perform two replacements in the second "example".
    1 point
  14. Hi there, This is a very simple code that i use for ControlClick on background windows with MouseClick cursor. To be honest i had made this for game automatation but its been very usefull to me on my latests projects with mouseclicking on background clients. Changes Added ControlClick for background windows on fullscreen or windowed modeWorks on any screen resolutionAlso added MouseClick function for windowed mode Cheers MsClick.au3
    1 point
  15. Jos

    AutoIt3ExecuteScript

    Add this line at the top of your script: #pragma compile(AutoItExecuteAllowed, true) Jos
    1 point
  16. To work with AD you could use my AD UDF (for download and wiki links please see my signature). To compare two AD groups I have a tool that allows to check members of one, both or neither group. Please check ADCG in the example scripts section (for link please see my signature)
    1 point
  17. Of course you're free to live a dangerous life.
    1 point
  18. No. $string = "string string string or else" $test = StringRegExpReplace($string, "(\s)", "+") ConsoleWrite($test & @LF) $test = StringReplace($string, " ", "+") ConsoleWrite($test & @LF)
    1 point
  19. Exit

    Help with a .bat file

    StringBetween() ???
    1 point
  20. AutoIt is one of the finest virus removal tools on the planet, widely known to get rid of derpware of all kinds, on all operating systems. Oh wait, its not.
    1 point
  21. Hey guys i just updated it because i used it on a project so i needed to update it for my use. Check 1st post for update
    1 point
  22. Try this: $hGui = GUICreate("Press any key to exit...", 400, 100) GUISetState() $sKeyboardState = _WinAPI_GetKeyboardState(1) While _WinAPI_GetKeyboardState(1) = $sKeyboardState Sleep(100) WEnd GUIDelete($hGui) Exit ; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_GetKeyboardState ; Description ...: Returns the status of the 256 virtual keys ; Syntax.........: _WinAPI_GetKeyboardState($iFlag=0) ; Parameters ....: $iFlag - Return Type ; 0 Returns an array[256] ; 1 Returns a string ; Return values .: Success - Array[256] or String containing status of 256 virtual keys ; Failure - False ; Author ........: Eukalyptus ; Modified.......: ; Remarks .......: If the high-order bit is 1, the key is down; otherwise, it is up. ; If the key is a toggle key, for example CAPS LOCK, then the low-order bit is 1 ; when the key is toggled and is 0 if the key is untoggled ; Related .......: _IsPressed ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _WinAPI_GetKeyboardState($iFlag = 0) Local $aDllRet, $lpKeyState = DllStructCreate("byte[256]") $aDllRet = DllCall("User32.dll", "int", "GetKeyboardState", "ptr", DllStructGetPtr($lpKeyState)) If @error Then Return SetError(@error, 0, 0) If $aDllRet[0] = 0 Then Return SetError(1, 0, 0) Else Switch $iFlag Case 0 Local $aReturn[256] For $i = 1 To 256 $aReturn[$i - 1] = DllStructGetData($lpKeyState, 1, $i) Next Return $aReturn Case Else Return DllStructGetData($lpKeyState, 1) EndSwitch EndIf EndFunc ;==>_WinAPI_GetKeyboardState Br, UEZ
    1 point
×
×
  • Create New...