Author: Sean Last Modified: 20071011
Seans standard library for different purposes, mostly about file and internet access. It is needed by some scripts from Sean.
File_AES(sFileFr, sFileTo, sPassword, SID = 256, bEncrypt = True)
File_CloseHandle(hFile)
File_CreateFile(sFile, nCreate = 3, nAccess = 0x1F01FF, nShare = 3, bFolder = False)
File_DeleteFile(sFile)
File_GetFileSize(hFile)
File_Hash(sFile, SID = "CRC32")
File_InternetCloseHandle(Handle)
File_InternetOpen(sAgent = "AutoHotkey", nType = 4)
File_InternetOpenUrl(hInet, sUrl, nFlags = 0, pHeaders = 0)
File_InternetReadFile(hFile, pBuffer, nSize = 1024)
File_InternetSetFilePointer(hFile, nPos = 0, nMove = 0)
File_InternetWriteFile(hFile, pBuffer, nSize = 1024)
File_ReadFile(hFileFr,&sBuffer,nSize)
File_ReadMemory(sFile, pBuffer, nSize = 512, bAppend = False)
File_SetEndOfFile(hFile)
File_SetFilePointer(hFile, bAppend ? 2 : 0)
File_WriteFile(hFileTo,&sBuffer,nSize)
File_WriteMemory(sFile, ByRef sBuffer, nSize = 0)
For more details of the functions's parameters and return value, please see it's source code.
This comes within the File.zip, together with Crypt.ahk. It supersedes and makes FileHelper.ahk deprecated.
For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?t=19608
nonexistent
; #Include Crypt.ahk ; #Include File.ahk #NoEnv SendMode Input SetWorkingDir %A_ScriptDir% ; http://www.autohotkey.com/forum/viewtopic.php?p=151228#151228 sFileOriginl := A_AhkPath ; Specify the real file path here! sPassword := "AutoHotkey" ; Specify your own password here! SID := 128 ; 128bit AES sFileEncrypt := A_Temp . "\encrypt" . SID . ".bin" ; Specify encrypted file path. sFileDecrypt := A_Temp . "\decrypt" . SID . ".exe" ; Specify decrypted file path. File_AES(sFileOriginl, sFileEncrypt, sPassword, SID, True) ; Encryption File_AES(sFileEncrypt, sFileDecrypt, sPassword, SID, False) ; Decryption SID := 192 ; 192bit AES sFileEncrypt := A_Temp . "\encrypt" . SID . ".bin" sFileDecrypt := A_Temp . "\decrypt" . SID . ".exe" File_AES(sFileOriginl, sFileEncrypt, sPassword, SID, True) ; Encryption File_AES(sFileEncrypt, sFileDecrypt, sPassword, SID, False) ; Decryption SID := 256 ; 256bit AES sFileEncrypt := A_Temp . "\encrypt" . SID . ".bin" sFileDecrypt := A_Temp . "\decrypt" . SID . ".exe" File_AES(sFileOriginl, sFileEncrypt, sPassword, SID, True) ; Encryption File_AES(sFileEncrypt, sFileDecrypt, sPassword, SID, False) ; Decryption MsgBox, % "CRC32:`t" . File_Hash(sFileOriginl, "CRC32") . "`n" . "MD5:`t" . File_Hash(sFileOriginl, "MD5") . "`n" . "SHA1:`t" . File_Hash(sFileOriginl, "SHA1") . "`n"