
memerim
-
Posts
70 -
Joined
-
Last visited
Reputation Activity
-
memerim reacted to UEZ in [Gdip] How to draw text on transparent bitmap?
Then look into the help file to checkout how to create a gradient background. 😉
-
memerim reacted to Subz in Cmd to autoit conversion
Hidden mode (although doesn't always work with $STDOUT_CHILD)
$pid = RunWait(@ComSpec & " /C " & $iC & $Commandline2, "", @SW_HIDE, $STDOUT_CHILD) This will return the text left of " ("
$out = StringLeft($out, StringInStr($out, " (", 0, 1) - 1)
-
memerim reacted to Subz in Problem getting correclty hande value
The reason for the difference is that your using "AutoIt Window Info (x64)" rather than "AutoIt Window Info (x86)".
-
memerim reacted to kornboy82 in I have to ControlClick 100-200x to click into BlueStacks
I know but I have the same behavior as jplumb had. Go read.
-
memerim reacted to KaFu in Screenshot area of background screen
Just comment the _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\test.bmp") line out?
-
memerim reacted to KaFu in Screenshot area of background screen
I think _WinAPI_DeleteObject($hBitmap) did not delete the object resulting in a memory leak, try this with _GDIPlus_ImageDispose($hBitmap) in your loop.
#include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPIHObj.au3> Local $handle = WinGetHandle("[CLASS:SciTEWindow]", "") Local $iRegion_X = 10, $iRegion_Y = 10, $iRegion_W = 100, $iRegion_H = 100 ; Initialize GDI+ library _GDIPlus_Startup() Local $hBitmap = Capture_Window($handle, _WinAPI_GetWindowWidth($handle), _WinAPI_GetWindowHeight($handle)) _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\test.bmp") ; Create 24 bit bitmap clone Local $hClone = _GDIPlus_BitmapCloneArea($hBitmap, $iRegion_X, $iRegion_Y, $iRegion_W, $iRegion_H, $GDIP_PXF24RGB) _GDIPlus_ImageSaveToFile($hClone, @ScriptDir & "\GDIPlus_Image.bmp") ; Clean up resources _GDIPlus_ImageDispose($hClone) _GDIPlus_ImageDispose($hBitmap) ; Shut down GDI+ library _GDIPlus_Shutdown() Func Capture_Window($hWnd, $w, $h) If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0) If Int($w) < 1 Then Return SetError(2, 0, 0) If Int($h) < 1 Then Return SetError(3, 0, 0) Local Const $hDC_Capture = _WinAPI_GetDC(HWnd($hWnd)) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, $w, $h) Local Const $hObjectOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) DllCall("gdi32.dll", "int", "SetStretchBltMode", "hwnd", $hDC_Capture, "uint", 4) DllCall("user32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) _WinAPI_DeleteDC($hMemDC) _WinAPI_SelectObject($hMemDC, $hObjectOld) _WinAPI_ReleaseDC($hWnd, $hDC_Capture) Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hFullScreen) Local Const $c1 = $aFullScreen[2] - @DesktopWidth, $c2 = $aFullScreen[3] - @DesktopHeight Local Const $wc1 = $w - $c1, $hc2 = $h - $c2 If (($wc1 > 1 And $wc1 < $w) Or ($w - @DesktopWidth > 1) Or ($hc2 > 7 And $hc2 < $h) Or ($h - @DesktopHeight > 1)) And (BitAND(WinGetState(HWnd($hWnd)), 32) = 32) Then Local $hBmp_t = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) $hBmp = _GDIPlus_BitmapCloneArea($hBmp_t, 8, 8, $w - 16, $h - 16) _GDIPlus_BitmapDispose($hBmp_t) Else $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) EndIf _WinAPI_DeleteObject($hHBitmap) Return $hBmp EndFunc ;==>Capture_Window
-
memerim reacted to KaFu in Screenshot area of background screen
#include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPIHObj.au3> Local $handle = WinGetHandle("[CLASS:SciTEWindow]", "") Local $hClone, $hImage, $iX, $i ; Initialize GDI+ library _GDIPlus_Startup() Local $hBitmap = Capture_Window($handle, _WinAPI_GetWindowWidth($handle), _WinAPI_GetWindowHeight($handle)) ;ConsoleWrite(_WinAPI_GetWindowWidth($handle)) _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\test.bmp") ; Create 24 bit bitmap clone $iX = _GDIPlus_ImageGetWidth($hBitmap) $iY = _GDIPlus_ImageGetHeight($hBitmap) $hClone = _GDIPlus_BitmapCloneArea($hBitmap, 0, 0, $iX, $iY, $GDIP_PXF24RGB) _GDIPlus_ImageSaveToFile($hClone, @ScriptDir & "\GDIPlus_Image.bmp") ; Clean up resources _GDIPlus_ImageDispose($hClone) _WinAPI_DeleteObject($hBitmap) ; Shut down GDI+ library _GDIPlus_Shutdown() Func Capture_Window($hWnd, $w, $h) If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0) If Int($w) < 1 Then Return SetError(2, 0, 0) If Int($h) < 1 Then Return SetError(3, 0, 0) Local Const $hDC_Capture = _WinAPI_GetDC(HWnd($hWnd)) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, $w, $h) Local Const $hObjectOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) DllCall("gdi32.dll", "int", "SetStretchBltMode", "hwnd", $hDC_Capture, "uint", 4) DllCall("user32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) _WinAPI_DeleteDC($hMemDC) _WinAPI_SelectObject($hMemDC, $hObjectOld) _WinAPI_ReleaseDC($hWnd, $hDC_Capture) Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hFullScreen) Local Const $c1 = $aFullScreen[2] - @DesktopWidth, $c2 = $aFullScreen[3] - @DesktopHeight Local Const $wc1 = $w - $c1, $hc2 = $h - $c2 If (($wc1 > 1 And $wc1 < $w) Or ($w - @DesktopWidth > 1) Or ($hc2 > 7 And $hc2 < $h) Or ($h - @DesktopHeight > 1)) And (BitAND(WinGetState(HWnd($hWnd)), 32) = 32) Then Local $hBmp_t = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) $hBmp = _GDIPlus_BitmapCloneArea($hBmp_t, 8, 8, $w - 16, $h - 16) _GDIPlus_BitmapDispose($hBmp_t) Else $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) EndIf _WinAPI_DeleteObject($hHBitmap) Return $hBmp EndFunc ;==>Capture_Window
-
memerim reacted to Jos in Sort ini file numerically
Something like this should be close: (make sure you have a backup before testing!)
#include <Array.au3> $sFilePath = "colours.ini" ; Read the INI section labelled 'General'. This will return a 2 dimensional array. Local $aArray = IniReadSection($sFilePath, "COLOURS") If @error Then Exit ; process data from section For $i = 1 To $aArray[0][0] ; convert KEY string to value $aArray[$i][0] = number($aArray[$i][0]) consolewrite("Key: " & $aArray[$i][0] & " Value: " & $aArray[$i][1] & @CRLF ) Next _ArraySort($aArray,0,1) ; Remove old unsorted Section from INI IniDelete($sFilePath,"COLOURS") ; Write sorted values For $i = 1 To $aArray[0][0] IniWrite($sFilePath,"COLOURS",$aArray[$i][0],$aArray[$i][1]) consolewrite("Key: " & $aArray[$i][0] & " Value: " & $aArray[$i][1] & @CRLF ) Next Jos
-
memerim reacted to Malkey in StringReplace in File
Try this example.
#cs <Proxy id="170" type="HTTPS"> <Address>142.44.223.144</Address> <Port>80</Port> <Options>48</Options> <Authentication enabled="true"> <Username>iucbzmbl-51</Username> <Password></Password> </Authentication> </Proxy> <Proxy id="171" type="HTTPS"> <Address>142.44.223.144</Address> <Port>80</Port> <Options>48</Options> <Authentication enabled="true"> <Username>iucbzmbl-59</Username> <Password></Password> </Authentication> </Proxy> <Proxy id="172" type="HTTPS"> <Address>142.44.223.144</Address> <Port>80</Port> <Options>48</Options> <Authentication enabled="true"> <Username>iucbzmbl-62</Username> <Password></Password> </Authentication> </Proxy> #ce Local $String = StringRegExpReplace(FileRead(@ScriptFullPath), "(?is)^.*?#cs\s+|\s+#ce.*$", "") ; Get test $String from comment block in this script. ; or ;Local $String = FileRead('C:\Users\CAIO\Downloads\proxy2.ppx') Local $sStart = "<Username>iucbzmbl-" Local $sEnd = "</Username>" Local $iInit = 100 - 1 ConsoleWrite(Execute("'" & StringRegExpReplace($String, "(?i)(?<=" & $sStart & ")(\d+)(?=" & $sEnd & ".*?)", "'&$iInit+Assign('iInit',$iInit+1)&'") & "'") & @CRLF)
-
memerim reacted to Nine in Controlsend & stored handle
Use this to actually create a handle (with or without ' or ")
$hwd = HWnd (0x001C1000) -
memerim reacted to Deye in Stop sound if win active
This should stop scripts playing sounds upon activating a folder that titles [title & .exe] = @ScriptName
While 1 Sleep(1000) $sTitle = WinGetTitle(WinGetHandle("", ""), "") If @ScriptName = $sTitle & ".exe" Then SoundPlay("") Exit EndIf WEnd Deye
-
memerim reacted to Jfish in Stop sound if win active
Try something like this (untested) - then just call that function with the parent process as the parameter. Check the UDF for _SoundStatus to get the status of a sound and also _soundPlay and _soundStop.
func _playSound($aParentProcessName) SoundPlay("C:\audios\"&StringTrimRight($aParentProcessName,4)&"\expired.wav") EndFunc -
memerim reacted to AdamUL in Detect process who executed script
Have a look at _WinAPI_GetParentProcess and _ProcessGetName. The script will need to be compiled for it to work correctly.
#include <Process.au3> #include <WinAPIProc.au3> Global $iScriptParentPID = _WinAPI_GetParentProcess(@AutoItPID) Global $sParentProcessName = _ProcessGetName($iScriptParentPID) MsgBox(0, "Process Name", $sParentProcessName) ;For testing.
Adam