File to Base64 String Code Generator v1.20 Build 2020-06-05 (embed your files easily)
-
Recently Browsing 0 members
No registered users viewing this page.
-
Similar Content
-
By SonJoe
Hi all,
I have compiled a script to exe (using aut2exe) and delivered it to another machine, which does not have AutoIt installed. There, it does not run, but tells me that an undefined variable is used.
I assume that the files referred to by #include are not embedded in the exe.
How can I make sure the included files are available, when I deploy the exe to another machine?
Thanks in advance for your helpful hints!
-
By CarlD
List (and, optionally, Delete) 0-byte files in current or specified directory; optionally, recurse through subdirectories.
The heart of the matter is func _ListZeroByteFiles().
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=ListZero.exe #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 -w 6 -d #AutoIt3Wrapper_Run_Au3Stripper=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; ; List (and, optionally, Delete) Zero-byte Files ; in current|specified directory ; Optionally, recurse through subdirs ; CLD rev. 2021-06-20 ; #cs Usage ----- ListZero d:\path1[ d:\path2 ...] [/R] [/-A] [/V] [/D[R]] /X:exclude_file [/?|/H] d:\path Path(s) to search (at least one is *required*) /R Recurse through subdirectories /-A Omit check for alternative data streams (ADS) /V Verbose: list subdirectory names in addition to files /D Delete listed files (NOT recommended on system drive) /DR Move listed files to Recycle bin /X:exclude_file Exclude files with *extensions* listed in exclude_file (one extension per line) /?|/H Help #ce #include <Misc.au3> #include <WinAPIFiles.au3> Global $sDir = "." Global $bSubDirs = 0, $sMsg = "", $iDeles = 0, $iFiles = 0, $bQuiet = 1 Global $sWinDrive = StringLeft(@WindowsDir, 2), $sTestStr = $sDir Global $vDele = 0, $sDeleWord = "", $sLastWord = "Deleted" Global $sExtFn = "", $aExts, $sExExts = "" Global $bADS = 1, $bNTFS = 0, $iRecurseLimit = 0 ; Test for at least one dir in command Global $p = $CmdLine[0] If $p Then For $i = 1 To $CmdLine[0] If StringInStr($CmdLine[$i], "/") = 1 Then $p -= 1 Next EndIf If $p < 1 Or StringInStr($CmdLineRaw, "/?") Or StringInStr($CmdLineRaw, "/H") Then Exit Consolewrite("List (and, optionally, Delete) Zero-byte Files [CLD rev.2021-02-07]" & @CRLF & @CRLF & StringTrimRight(@ScriptName, 4) & " d:\path1[ d:\path2 ...] [/R] [/-A] [/V] [/D[R]] /X:exclude_file [/?|/H]" & @CRLF & @CRLF & "d:\path Path(s) to search (at least one is *required*)" & @CRLF & "/R Recurse through subdirectories" & @CRLF & "/-A Omit check for alternate data streams (ADS)" & @CRLF & "/V Verbose: list subdirectory names in addition to files" & @CRLF & "/D Delete listed files (NOT recommended on system drive)" & @CRLF & "/DR Move listed files to Recycle bin" & @CRLF & "/X:exclude_file" & @CRLF & " Exclude files with *extensions* listed in exclude_file" & @CRLF & " (one extension per line)" & @CRLF & "/?|/H Help" & @CRLF) If StringInStr($CmdLineRaw, "/R") Then $bSubDirs = 1 If StringInStr($CmdLineRaw, "/-A") Then $bADS = 0 If StringInStr($CmdLineRaw, "/D") Then $vDele = 2 $sDeleWord = "Delet" If StringInStr($CmdLineRaw, "/DR") Then $vDele = 1 $sDeleWord = "Recycl" EndIf $sDeleWord &= "ed ==> " EndIf If StringInStr($CmdLineRaw, "/V") Then $bQuiet = 0 If StringInStr($CmdLineRaw, "/X:") Then $sExtFn = StringTrimLeft($CmdLineRaw, 2 + StringInStr($CmdLineRaw, "/X:")) While StringInStr($sExtFn, " ") = 1 $sExtFn = StringTrimLeft($sExtFn, 1) WEnd If StringInStr($sExtFn, """") = 1 Then $sExtFn = StringTrimLeft($sExtFn, 1) If StringInStr($sExtFn, """") Then $sExtFn = _ StringTrimRight($sExtFn, StringLen($sExtFn) - StringInStr($sExtFn, """")) Else If StringInStr($sExtFn, " ") Then $sExtFn = StringTrimRight($sExtFn, StringLen($sExtFn) - StringInStr($sExtFn, " ")) EndIf If FileExists($sExtFn) Then Global $h1 = FileOpen($sExtFn) $sExExts = FileRead($h1) FileClose($h1) If $sExExts Then If StringInStr($sExExts, @CRLF) Then $aExts = StringSplit($sExExts, @CRLF) $sExExts = "." For $i = 1 To $aExts[0] If $aExts[$i] Then $sExExts &= $aExts[$i] & "." Next Else $sExExts = "." & $sExExts & "." EndIf EndIf EndIf EndIf If $vDele = 2 And StringInStr($CmdLineRaw, $sWinDrive) Then ConsoleWrite("Warning: Deleting zero-byte files in the system drive (" & $sWinDrive & ") is not recommended." & @CRLF & "Are you sure you want to continue? (y|N)" & @CRLF) Global $hDLL = DLLOpen("user32.dll") While 1 If _IsPressed("59", $hDLL) Then ConsoleWrite(@CRLF) ExitLoop ElseIf _IsPressed("1B", $hDLL) Or _IsPressed("4E", $hDLL) Then DLLClose($hDLL) ConsoleWrite(@CRLF & "Quitting..." & @CRLF) Exit Else Sleep(20) EndIf WEnd DLLClose($hDLL) EndIf If $bSubDirs Then ConsoleWrite("Working... (Ctrl+C quits)" & @CRLF) For $i = 1 To $CmdLine[0] If StringInStr($CmdLine[$i], "/") = 1 Then ContinueLoop If $CmdLine[$i - 1] = "/X" Then ContinueLoop If StringRight($CmdLine[$i], 1) <> "\" Then $CmdLine[$i] &= "\" $CmdLine[$i] &= "\" $bNTFS = _SetbNTFS($CmdLine[$i]) $iDeles += _ListZeroByteFiles($CmdLine[$i], $bSubDirs) Next If $vDele = 1 Then $sLastWord = "Recycled" Global $iDiff = 7 + StringLen("Deleted") - StringLen($sLastWord) $sMsg = "Found " & StringFormat("%7s", _IntFormat($iFiles)) & " " & _OneMany("file", $iFiles) & @CRLF & $sLastWord & " " & StringFormat("%" & String($iDiff) & "s", _IntFormat($iDeles)) & " " & _OneMany("file", $iDeles) Exit ConsoleWrite(@CRLF & $sMsg & @CRLF) ;--- Func _ListZeroByteFiles($sPath = ".", $bRecurs = 0) ; List|Delete 0-byte files in current or specified directory ; Optionally, recurse through subdirectories ; Returns number of 0-byte files deleted $iRecurseLimit += 1 If $iRecurseLimit = 200 Then $iRecurseLimit = 0 Return EndIf If StringRight($sPath, 1) <> "\" Then $sPath &= "\" If StringRight($sPath, 1) = "\" Then $sPath &= "*" If Not FileExists($sPath) Then Return 0 Local $sFn = "", $iC = 0, $iC2 = 0, $bEx = 0 Local $sDirName = _FileGetPath($sPath) Local $h = FileFindFirstFile($sPath) If $h = -1 Then Return 0 While 1 $sFn = $sDirName & "\" & FileFindNextFile($h) If @error Then FileClose($h) ExitLoop EndIf $bEx = @extended If StringInStr($sFn, ":") = 2 Then $sFn = StringUpper(StringLeft($sFn, 1)) & StringTrimLeft($sFn, 1) If $bEx = 0 Then; we have a file If _FileGetSizeADS($sFn) = 0 Then If $sExExts Then If StringInStr($sExExts, "." & _FileGetExt($sFn) & ".") Then ContinueLoop EndIf $iFiles += 1 Switch $vDele Case 0 Case 1 If FileRecycle($sFn) Then $iC += 1 Case 2 If FileDelete($sFn) Then $iC += 1 EndSwitch ConsoleWrite($sDeleWord & $sFn & @CRLF) EndIf Else; we have a directory If $bRecurs Then If $bQuiet = 0 Then ConsoleWrite("Searching " & $sFn & @CRLF) $iC2 = _ListZeroByteFiles($sFn, 1) If $iC2 > 0 Then $iC += $iC2 $iC2 = 0 EndIf EndIf WEnd Return $iC EndFunc ;==>_ListZeroByteFiles Func _FileGetExt($sFn) ; Parse ext from [d:\path\]filename.ext Local $sExt = "", $aA If StringInStr($sFn, ".") Then If StringInStr(FileGetAttrib($sFn), "D") Then Return $sExt $aA = StringSplit($sFn, ".") $sExt = $aA[$aA[0]] EndIf Return $sExt EndFunc ;==>_FileGetExt Func _FileGetPath($sFn) ; Parse directory from path\file; final "\" is trimmed Local $sDirr = "" Local $aA = StringSplit($sFn, "\") Local $iS = $aA[0] - 1 If Not StringInStr(FileGetAttrib($aA[$aA[0]]), "D") Then $iS += 1 For $i = 1 To $iS $sDirr &= $aA[$i] & "\" Next While StringRight($sDirr, 1) = "\" $sDirr = StringTrimRight($sDirr, 1) WEnd Return $sDirr EndFunc ;==>_FileGetPath Func _FileGetSizeADS($sFile) Local $sErrW, $sFnTmp, $aFnTmp Local $iSize = FileGetSize($sFile) If Not ($bADS And $bNTFS) Then Return $iSize $iSize = 0 Local $pData = _WinAPI_CreateBuffer(1024) Local $tFSD = DllStructCreate($tagWIN32_FIND_STREAM_DATA) Local $hSearch = _WinAPI_FindFirstStream($sFile, $tFSD) While Not @error $iSize += DllStructGetData($tFSD, 'StreamSize') _WinAPI_FindNextStream($hSearch, $tFSD) WEnd Switch @extended Case 38 ; ERROR_HANDLE_EOF Case Else $sErrW = _WinAPI_GetErrorMessage(@extended) $aFnTmp = StringSplit($sFile, "\") $sFnTmp = $aFnTmp[$aFnTmp[0]] If Not StringRight($sErrW, 13) = "successfully." Then _ ConsoleWrite("--> " & $sFnTmp & ": " & $sErrW & @CRLF) EndSwitch _WinAPI_FindClose($hSearch) _WinAPI_FreeMemory($pData) Return $iSize EndFunc ;==>_FileGetSizeADS Func _IntFormat($n, $s = ",", $sd = ".") ; Insert commas|specified separator into integer If StringIsInt($n) Then Local $a, $d = "", $x If StringInStr($n, $sd) Then $a = StringSplit($n, $sd) $n = $a[1] $d = $sd & $a[2] EndIf $x = $n $n = "" While StringLen($x) > 3 $n = $s & StringRight($x, 3) & $n $x = StringTrimRight($x, 3) WEnd $n = $x & $n EndIf Return ($n & $d) EndFunc ;==>_IntFormat Func _OneMany($sSingular, $iCount, $sPlural = "") ; Returns singular or plural depending on count ; Plural appends S to singular (ES if it ends in S) ; unless $sPlural is supplied Local $sEss = "s" If StringRight($sSingular, 1) = "s" Then $sEss = "es" If StringUpper($sSingular) == $sSingular Then $sEss = StringUpper($sEss) If Not $sPlural Then $sPlural = $sSingular & $sEss If Abs($iCount) = 1 Then Return $sSingular Else Return $sPlural EndIf EndFunc ;==>_OneMany Func _SetbNTFS($sPath) If DriveGetFileSystem(StringLeft($sPath, 3)) = "NTFS" Then Return 1 Else Return 0 EndIf EndFunc ;==>_SetbNTFS
-
By lIlIIlIllIIIIlI
$input = $CmdLine[1] $bytes = 1000000 ; 1000000 for 1 MB, 1000 for 1 KB $size = FileGetSize($input) $file = fileopen($input, 16) $max = ceiling($size / $bytes) for $i = 1 to $max $data = fileread($file, $bytes) $output = $input & '_' & $i & 'of' & $max filewrite($output, $data) next ^file split
file path for a 20MB "video.mp4" is input, it will be output as "video.mp4_1of20", "video.mp4_2of20", etc. change $bytes to affect the split files size, this example made them 1MB (10^6 bytes)
$input = $CmdLine[1] $name = stringtrimright($input, 1 + stringlen($input) - stringinstr($input, '_', 0, -1)) $split = stringsplit($input, 'of', 3) $max = $split[ubound($split) - 1] for $i = 1 to $max $in = $name & '_' & $i & 'of' & $max $file = fileopen($in, 16) $data = fileread($file) fileclose($file) filedelete($in) filewrite($name, $data) next ^ file join
file path for any of the "video.mp4_Xof20" segments is input. the "video.mp4_Xof20" segments are read and written to "video.mp4" and then deleted, leaving the newly joined "video.mp4" in the end
i made this today because i had a big file that i couldn't really open. i split it into 1000 chunks to make processing and stuff easier. i've also used it to split files to just under 25MB segments so i can attach and mail big files over gmail which is silly but it worked
-
By Synaps3
This script will make it so you can press Alt + "+" in Windows Explorer to select all files with the current file extension. This is something that I wanted for a long time and it should be a feature in Windows, but it's not. The only way to get close is to use the search thing (but then it shows the results excluding everything else) or to group by that type, but I don't want it grouped.
You can press Alt + Enter right after to open properties on those files or you can press delete to delete only files of that type.
You need the "Automating Windows Explorer" pack here: https://www.autoitscript.com/forum/topic/162905-automating-windows-explorer/
#include "Includes\AutomatingWindowsExplorer.au3" #include <Array.au3> Opt( "MustDeclareVars", 1 ) HotKeySet("!=", "SelectTypes") Func SelectTypes() ; Windows Explorer on XP, Vista, 7, 8 Local $hExplorer = WinGetHandle("[REGEXPCLASS:^(Cabinet|Explore)WClass$]") If Not $hExplorer Then MsgBox(0, "Explorer", "Could not find Windows Explorer.") Return EndIf $hExplorer = WinActive("[REGEXPCLASS:^(Cabinet|Explore)WClass$]") If Not $hExplorer Then MsgBox(0, "Explorer", "Windows Explorer is not in focus.") Return EndIf ; Get an IShellBrowser interface GetIShellBrowser($hExplorer) If Not IsObj($oIShellBrowser) Then MsgBox(0, "Explorer", "Could not get an IShellBrowser interface.") Return EndIf ; Get other interfaces GetShellInterfaces() ; Get selected files with full path ;GetFiles( $fSelected = False, $fFullPath = False, $fPidl = False, $iMax = 0 ) Local $aAllFiles = GetItems(False, False) Local $aFiles = GetItems(True, False) Local $sExt Local $i If UBound($aFiles) = 1 Then ;MsgBox(0, "Selected", $aFiles[0]) $sExt = StringRight($aFiles[0], StringLen($aFiles[0]) - StringInStr($aFiles[0], ".", 0, -1)) ;MsgBox(0, "Selected", $sExt) For $i = 0 To UBound($aAllFiles) - 1 If StringInStr($aAllFiles[$i], ".") > 0 Then If StringRight($aAllFiles[$i], StringLen($aAllFiles[$i]) - StringInStr($aAllFiles[$i], ".", 0, -1)) = $sExt Then SetSelectedItem($i) EndIf EndIf Next Else MsgBox($MB_ICONWARNING, "Error", "None or multiple items selected!") EndIf EndFunc While 1 GUIGetMsg() Wend
-
By amosrinat
Hi,
i have an AutoIT script that sends emails with two embedded images.
When users get the email they don't see the images. How should I fix my code?
Thank you for your support,
Amos
Func fSendMail() $TemplateName = StringRegExpReplace($Template, "^.*\\|\..*$", "") $SmtpServer = "smtp.**.com" $FromName = "do-not-reply@*********" $FromAddress = "do-not-reply@******" $ToAddress = $MG1_Mgr & ";"& $Owner $Subject = "ACTION REQUIRED - " & $TemplateName $Body = $sBody5 $IPPort = 25 $ssl = 0 Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = fINetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $IPPort, $ssl) If @error Then MyErrFunc() EndIf EndFunc;fSendMail Func fINetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 Then $IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort $objEmail.Configuration.Fields.Update $objEmail.Fields.Update ;$objEmail.Send **************** If @error Then MyErrFunc() EndIf $objEmail = "" EndFunc;fINetSmtpMailCom
-
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now