
Loop %A_WinDir%\System32\*.dll { InCache( Files, A_LoopFileShortName, 10, "[color=#FF0000]`n[/color]" ) TrayTip, System DLL files, %Files%, 10, 1 }
InCache() Code Updated:
To delete an item from cache, pass -1 as third parameter ( parameter Max )
Loop %A_WinDir%\System32\*.dll { InCache( Files, A_LoopFileShortName, 10, "[color=#FF0000]`n[/color]" ) TrayTip, System DLL files, %Files%, 10, 1 }
#SingleInstance force TargetDir = D:\ F5:: clipboard = Send, ^c ClipWait GlobalFileList = %clipboard% flags := ( FOF_NOCONFIRMMKDIR := 0x200 ) | (FOF_NOCONFIRMATION := 0x10) Loop, parse, GlobalFileList, `r`n { if (A_LoopField <> "") { ;MsgBox, Source %A_LoopField%, Target is %TargetDir% ShellFileOperation(0x2, A_LoopField, TargetDir, flags) } } Return ShellFileOperation( fileO=0x0, fSource="", fTarget="", flags=0x0, ghwnd=0x0 ) { If ( SubStr(fSource,0) != "|" ) fSource := fSource . "|" If ( SubStr(fTarget,0) != "|" ) fTarget := fTarget . "|" fsPtr := &fSource Loop, % StrLen(fSource) If ( *(fsPtr+(A_Index-1)) = 124 ) DllCall( "RtlFillMemory", UInt, fsPtr+(A_Index-1), Int,1, UChar,0 ) ftPtr := &fTarget Loop, % StrLen(fTarget) If ( *(ftPtr+(A_Index-1)) = 124 ) DllCall( "RtlFillMemory", UInt, ftPtr+(A_Index-1), Int,1, UChar,0 ) VarSetCapacity( SHFILEOPSTRUCT, 30, 0 ) ; Encoding SHFILEOPSTRUCT NextOffset := NumPut( ghwnd, &SHFILEOPSTRUCT ) ; hWnd of calling GUI NextOffset := NumPut( fileO, NextOffset+0 ) ; File operation NextOffset := NumPut( fsPtr, NextOffset+0 ) ; Source file / pattern NextOffset := NumPut( ftPtr, NextOffset+0 ) ; Target file / folder NextOffset := NumPut( flags, NextOffset+0, 0, "Short" ) ; options DllCall( "Shell32\SHFileOperationA", UInt,&SHFILEOPSTRUCT ) Return NumGet( NextOffset+0 ) }
is there any link to download those functions or something ?
GZIP_DecompressBuffer()
Decompression for an in-memory 'single-file no-name GZIP' using 'Microsoft GZIP Compression DLL'
To create a single-file no-name GZIP, we may do it as
gzip.exe -k --no-name sourcefilename.extension
..and to uncompress it
gzip.exe -d sourcefilename.extension.gz
.. but this function was written for a different purpose. Certain websites use GZIP for 'content encoding' and we do not feel a thing because every popular browser decompresses them automatically ... to display the content as well when we click select a file download. Even DoFileDownload() uncompresses the file before saving it to disk.
The problem arises when we use UrlDownloadToFile. We have to use gzip.exe or compatibles to uncompress the content. I use InternetFileRead() for downloading.. and Microsoft does provide a WININET solution, but unfortunately for Vista and above.. ( I'm on XP ).. and so, I had to create this function for in-memory decompression.
About 'Microsoft GZIP Compression DLL' : gzip.dll, is a compact DLL ( 31.5 KiB ) and is only dependent on Kernel32.dll.. It definitely resides somewhere deep inside Windows folder, atleast that is what I guess..
Here follows the function along with a testing example:
GZIP_DecompressBuffer( ByRef var ) { ; '[color=darkred]Microsoft GZIP Compression DLL[/color]' [color=indigo]SKAN 20-Sep-2010[/color] ; [color=black]Decompress routine for 'no-name single file GZIP', available in process memory[/color]. ; [color=black]Forum post : [/color] www.autohotkey.com/forum/viewtopic.php?p=384875#384875 nSz := VarSetCapacity( var ), vSz := NumGet( var,nsz-4 ), VarSetCapacity( out,vsz,0 ) DllCall( "GZIP\InitDecompression" ) DllCall( "GZIP\CreateDecompression", UIntP,CTX, UInt,1 ) If ( DllCall( "GZIP\Decompress", UInt,CTX, UInt,&var, UInt,nsz, UInt,&Out, UInt,vsz , UIntP,input_used, UIntP,output_used ) = 0 && ( Ok := ( output_used = vsz ) ) ) VarSetCapacity( var,64 ), VarSetCapacity( var,0 ), VarSetCapacity( var,vsz,32 ) , DllCall( "RtlMoveMemory", UInt,&var, UInt,&out, UInt,vsz ) DllCall( "GZIP\DestroyDecompression", UInt,CTX ), DllCall( "GZIP\DeInitDecompression" ) Return Ok ? vsz : 0 } ; Usage Example : SetWorkingDir, %A_ScriptDir% IfNotExist,gzip.dll, URLDownloadToFile , http://www.autohotkey.net/~goyyah/GZIP/gzip.dll, gzip.dll ; 32256 bytes IfNotExist,gpl.gz, URLDownloadToFile , http://www.autohotkey.net/~goyyah/GZIP/gpl.gz, gpl.gz ; 6794 bytes DllCall( "LoadLibrary", Str,"gzip.dll" ) ; Load GZIP library FileRead, Var, gpl.gz sz := GZIP_DecompressBuffer( Var ) MsgBox, 0, Expanded Size: %sz% bytes, %Var% ReturnPS: I have not written a GZIP_CompressBuffer() because VarZ wrapper is superior, in the sense that it uses documented functions.
In need of a lost file from user SKAN of autohotkey.net!
If someone still have the compiled gzip.exe or original source code to compile and may upload it or send me attached to mail.
I would like to use it with built-in microsoft gzip.dll into Windows.
wish me good luck.
PixelCheckSum()
Generates a CheckSum for a region of pixels in Screen/Window
Credit: Thanks to Sean. Screen Capture with Transparent Windows and Mouse Cursor
PixelCheckSum( X=0, Y=0, W=3, H=3, Title="" ) { hWn := WinExist( Title ), hDC := DllCall( "[color=#D62A00]GetDC[/color]", UInt,hWn ) mDC := DllCall( "[color=#D62A00]CreateCompatibleDC[/color]", UInt,hDC ) NumPut( VarSetCapacity(BI,40,0),BI ), NumPut( W,BI,4 ) , NumPut( H,BI,8 ) NumPut( 32,NumPut( 1,BI,12,"UShort" ),0,"UShort" ) , NumPut( 0,BI,16 ) hBM := DllCall( "[color=#D62A00]CreateDIBSection[/color]", UInt,mDC, UInt,&BI , Int,0, UIntP,pB, Int,0,Int,0 ) oBM := DllCall( "[color=#D62A00]SelectObject[/color]", UInt,mDC, UInt,hBM ) , Rop := 0x40000000|0x00CC0020 DllCall( "[color=#D62A00]BitBlt[/color]", UInt,mDC, Int,0,Int,0, Int,W,Int,H, UInt,hDC, Int,X,Int,Y, UInt,Rop ) DllCall( "[color=#D62A00]shlwapi\HashData[/color]", UInt,pB, UInt,W*H*4, Int64P,Hash, UInt,8 ) VarSetCapacity(HH,16,0), DllCall( "[color=#D62A00]msvcrt\sprintf[/color]", Str,HH, Str,"%016I64X",UInt64,Hash ) DllCall( "[color=#D62A00]DeleteObject[/color]", UInt,hBM ), DllCall( "[color=#D62A00]DeleteObject[/color]", UInt,oBM ) DllCall( "[color=#D62A00]DeleteDC[/color]", UInt,mDC ), DllCall( "[color=#D62A00]ReleaseDC[/color]", UInt,hWn, UInt,hDC ) Return HH }; Example - Wait for a Screen Region to change ChkSum := PixelChecksum( 0,0,10,10 ) While % ( ChkSum = PixelChecksum( 0,0,10,10 ) ) Sleep, 100 MsgBox, Screen Region Change Detected! Return
This code does not work.
Could anybody fix it?
Thank You!
; Example - Wait for a Screen Region to change ChkSum := PixelChecksum( 0,0,10,10 ) While % ( ChkSum = PixelChecksum( 0,0,10,10 ) ) Sleep, 100 MsgBox, Screen Region Change Detected! Return PixelCheckSum( X, Y, W, H, Title="" ) { hWn := WinExist( Title ), hDC := DllCall( "GetDC", UInt,hWn ) mDC := DllCall( "CreateCompatibleDC", UInt,hDC ) NumPut( VarSetCapacity(BI,40,0),BI ), NumPut( W,BI,4 ) , NumPut( H,BI,8 ) NumPut( 32,NumPut( 1,BI,12,"UShort" ),0,"UShort" ) , NumPut( 0,BI,16 ) hBM := DllCall( "CreateDIBSection", UInt,mDC, UInt,&BI , Int,0, UIntP,pB, Int,0,Int,0 ) oBM := DllCall( "SelectObject", UInt,mDC, UInt,hBM ) , Rop := 0x40000000|0x00CC0020 DllCall( "BitBlt", UInt,mDC, Int,0,Int,0, Int,W,Int,H, UInt,hDC, Int,X,Int,Y, UInt,Rop ) DllCall( "shlwapi\HashData", UInt,pB, UInt,W*H*4, Int64P,Hash, UInt,8 ) VarSetCapacity(HH,16,0), DllCall( "msvcrt\sprintf", Str,HH, Str,"%016I64X",UInt64,Hash ) DllCall( "DeleteObject", UInt,hBM ), DllCall( "DeleteObject", UInt,oBM ) DllCall( "DeleteDC", UInt,mDC ), DllCall( "ReleaseDC", UInt,hWn, UInt,hDC ) Return HH }
This script works only for ahk 32-bit.
Can anybody make it work for ahk 64-bit?
Thank You!
Hi malcev,
I have re-written the function to work in AutoHotkey 1.1 : http://goo.gl/X5dfvn
Good morning, SKAN!
Thank You very much for this function!!!
It works best!
Many-many Thanks!!!