Jump to content
UEZ

File to Base64 String Code Generator v1.20 Build 2020-06-05 (embed your files easily)

Recommended Posts

Very similar to this script:

I make use of Base64 encoding features, the compression is much better!

João Carlos.

Indeed, very similar script. Well, I implemented also a Base64 version but the compression wasn't better. Have a look here: Base64 version

Either I missed something or it is as it is.

I wanted to try your example but when mouse is over bottom button, merlin disapears...

This appears with Windows XP only. Just move these 2 lines

_WinAPI_DeleteObject($Bmp_Logo)
_WinAPI_DeleteObject($Bmp_Button)

to

Case $GUI_EVENT_CLOSE
            _WinAPI_DeleteObject($Bmp_Logo)
            _WinAPI_DeleteObject($Bmp_Button)
            GUIDelete($hGUI)
            Exit

and should work. Btw, the button looks awful on WinXP :D

Thanks for your feedback!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Changed the code from binary string to base64 string to save some more bytes :D

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Your first version worked fine, this one crashes on my Win7-64bit while converting.

Strange, because I'm using Win7 x64 in general, too! Which file your are converting and on which stage it is crashing (while compression or base64 converting)? What is the error code?

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

It crashes in the _Base64Encode() function. I've got DEP activated, and I guess you're missing a _MemVirtualAlloc() for the codebuffer there.

Edit: Btw, this one came exactly at the right time and the "File to Hex Binary Converter" version went right into :D, thanks a lot! I'll switch to the Base64 on the next release.

Edit #2:

Add #include <Memory.au3> at the top and change the _Base64Encode() function to this :oops:...

Func _Base64Encode($Data, $LineBreak = 0)
    Local $Opcode = "0x5589E5FF7514535657E8410000004142434445464748494A4B4C4D4E4F505152" _
                                  & "535455565758595A6162636465666768696A6B6C6D6E6F707172737475767778" _
                                  & "797A303132333435363738392B2F005A8B5D088B7D108B4D0CE98F0000000FB6" _
                                  & "33C1EE0201D68A06880731C083F901760C0FB6430125F0000000C1E8040FB633" _
                                  & "83E603C1E60409C601D68A0688470183F90176210FB6430225C0000000C1E806" _
                                  & "0FB6730183E60FC1E60209C601D68A06884702EB04C647023D83F90276100FB6" _
                                  & "730283E63F01D68A06884703EB04C647033D8D5B038D7F0483E903836DFC0475" _
                                  & "0C8B45148945FC66B80D0A66AB85C90F8F69FFFFFFC607005F5E5BC9C21000"
    Local $pProc = _MemVirtualAlloc(0, BinaryLen($Opcode), $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)
    Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]",$pProc)
    DllStructSetData($CodeBuffer, 1, $Opcode)
    $Data = Binary($Data)
    Local $Input = DllStructCreate("byte[" & BinaryLen($Data) & "]")
    DllStructSetData($Input, 1, $Data)
    $LineBreak = Floor($LineBreak / 4) * 4
    Local $OputputSize = Ceiling(BinaryLen($Data) * 4 / 3)
    $OputputSize = $OputputSize + Ceiling($OputputSize / $LineBreak) * 2 + 4
    Local $Ouput = DllStructCreate("char[" & $OputputSize & "]")
    DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), "ptr", DllStructGetPtr($Input), "int", BinaryLen($Data), "ptr", DllStructGetPtr($Ouput), "uint", $LineBreak)
    _MemVirtualFree($pProc, BinaryLen($Opcode), $MEM_DECOMMIT)
    Return DllStructGetData($Ouput, 1)
EndFunc   ;==>_Base64Encode
Edited by KaFu

Share this post


Link to post
Share on other sites

Fixed some bugs (no base64 conversation on small files and checkbox logic issues) and added DEP check to add program to the exclusion list to avoid hard crash.

Edit: I will add the modified _Base64Encode() function by KaFu in the next release!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Grrr, sorry, found another bug when compression is unselected! Last 2 lines of the function have been forgotten! :D

Br,

UEZ :oops:


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

@jscript: your are welcome.

Updated to v1.00 final and changed name to File to Base64 String Code Generator.

If you find bugs or have any suggestions please let me know!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Very nice script!

Would suggest to check if compression reduced size, if not continue with uncompressed data.

Thanks for you suggestion - makes sense!

Next release will check whether compression increases the size and skip to uncompressed binary automatically!

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

UEZ, you are giving me credit for base64 code but that code is not mine as far as I know. The only base64 code I have ever used in that form is Ward's and it's inside AutoItObject.au3, working in both x86 and x64 versions of interpreter.

I have written base64 UDF code using Windows API for, but not this.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

You're right, seems to be Wards code and I would recommend to switch to Wards code as these functions support x64 as well :D (+ this is already DEP save).

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • 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 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-02-07 ; #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 ; 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 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 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  
    • By matwachich
      AutoIt3 Lua Wrapper
      This is an AutoIt3 wrapper for the Lua scripting language. Consider it beta software, but since I will be using it in commercial product, expect it to evolve.
      It has been developped with Lua 5.3.5. Updates will come for new Lua version.
      Everything works just fine, except one (big) limitation: Anything that throws a Lua error (using C setjmp/longjmp functionality) will crash your AutoIt program. That means that it is impossible to use throw errors from an AutoIt function called by Lua (luaL_check*, lua_error...).
      It is hosted in Github: https://github.com/matwachich/au3lua
      Simple example
      #include <lua.au3> #include <lua_dlls.au3> ; Initialize library _lua_Startup(_lua_ExtractDll()) OnAutoItExitRegister(_lua_Shutdown) ; create new execution state $pState = _luaL_newState() _luaopen_base($pState) ; needed for the lua's print function $iRet = _luaL_doString($pState, 'print("Hello, world!")') If $iRet <> $LUA_OK Then ; read the error description on top of the stack ConsoleWrite("!> Error: " & _lua_toString($pState, -1) & @CRLF) Exit EndIf ; close the state to free memory (you MUST call this function, this is not AutoIt's automatic memory management, it's a C library) _lua_close($pState)
×
×
  • Create New...