Sign in to follow this  
Followers 0
JScript

CreateFilesEmbedded.au3 - Like FileInstall...

49 posts in this topic

#1 ·  Posted (edited)

CreateFilesEmbedded.exe

Application to embed files into their programs in the format .AU3


I present a different format to add files in your script:

So how about having our files (photos, text, executables) built?

1 - We can use the binary variables with

2 - We can test the fully functional program with F5 SciTE

4 - Use your imagination!!!

Sintax / Examples:

#include "YourFileEmbedded.au3"

; Returning the code in binary format
$bData = _YourFileEmbedded()

; Saving the code in the HDD
_YourFileEmbedded( True, @ScriptDir)

; Saving and running the code
_YourFileEmbedded( True, @ScriptDir, True)

; Finally, running the code directly
Run(_YourFileEmbedded(True))

Language file sample:

; #INDEX# =======================================================================================================================
; Title .........: CreateFilesEmbedded™
; Module ........: Language
; Author ........: Reaper HGN
; Link ..........: http://www.autoitscript.com/forum/topic/132564-createfilesembeddedau3-like-fileinstall/#entry930932
; Language ......: English (United States)
; ===============================================================================================================================

[0409]
1 = Options for the output file.
2 = Create a function based on the output name.
3 = Adding patterns of User Defined Functions (UDF).
4 = Only create the output file with the binary.
5 = Adding native LZNT Windows compression.
6 = Compression level
7 = &Open File
8 = Embedding file
9 = Test
10 = Default
11 = Progress of conversion:
12 = Exit
13 = Converted Lines
14 = Choose a file to embed
15 = The file
16 = no exist!
17 = 'The test only with the option: "Create a function based on the output name" activated!'
18 = Wait, creating the file. AU3 ->
19 = Save the file as built
20 = Compressing the file, wait...
21 = Done!
22 = The file
23 = was embedded in the format .AU3!

Supports:

; All file types!

Downloads:

Version: 2.27

CreateFilesEmbedded_(RedirectLink).html

(Previous downloads: 575)

Example using the binary return (without writing the file in HDD)

BinarySoundTest.zip

Sample:

Posted Image

Fixes:

  • 2.27.0912.2600
  • 27/09/2012 -> Some bugs fixed and added multi-language support!
  • 1.15.0911.2600b
  • 02/09/2011 -> First release!


Free Software

Redistribute and change under these terms:

1 - This program is free software: you can redistribute it and / or modify it under the terms of the GNU General Public License

As published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

2 - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, without even the implied warranty

of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

3 - You should have received a copy of the GNU General Public License along with this program.

If not, see http://www.gnu.org/licenses.

João Carlos.

Edited by Melba23
File removed at JScript's request

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well, Portuguese is a lot like my native language, I was surprised when I actually understood everything in that language, I didn't know it was so similar to Spanish.

CreateFilesEmbedded.au3

Edited by THAT1ANONYMOUSEDUDE

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

@THAT1ANONYMOUSEDUDE

Muchas gracias!

¡Tienes razón! És muy parecida...

Thank you very much!

You're right! Is very similar

João Carlos.

muchas? zomg i love muchas! corn chips, salsa, melted cheese, tomato...what more could you want in a food?


ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites

i tested with the same file

With FileInstall - 3.87 Mb

With CreateFilesEmbedded.au3 - 6.70 Mb (- LZNT level 2)

for me it's not ok.

thanks.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@SandelPerieanu

Very strange, see this example:

Download: Test_(Embedded&FileInstall).zip

Test_(Embedded).au3

#AutoIt3Wrapper_Compression=4           ;Compression parameter 0-4  0=Low 2=normal 4=High. Default=2
#AutoIt3Wrapper_UseUpx=y                ;(Y/N) Compress output program.  Default=Y
 
#include "Zune.au3" ; 970KB, LZNT level 2
 
_Zune(True, @TempDir)
Test_(Embedded).exe = 978KB

Test_(FileInstall).au3

#AutoIt3Wrapper_Compression=4           ;Compression parameter 0-4  0=Low 2=normal 4=High. Default=2
#AutoIt3Wrapper_UseUpx=y                ;(Y/N) Compress output program.  Default=Y
 
FileInstall(".Zune.msstyles", @TempDir) ; 12.028KB
Test_(FileInstall).exe = 1.736KB

Conclusion: Who is smaller?

João Carlos.

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

Conclusion: Who is smaller?

it depends on how "compress able" a file is.

AutoIt uses a very week compression for script and fileinstall, but it stores it better.

Your function compresses much better, but stores not efficient (Hex values not binary)

Anyway thank you very much for this script. :graduated:

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@JFX

You're right! I'll see what I can do to improve it...

Do you have any idea? I was thinking of store in resource...

João Calos.

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

hmm, store in resource would be a very good solution for complied scripts.

for not complied it could be Base64 encoded, like in some other script (ex. AutoitObject)

Share this post


Link to post
Share on other sites

hmm, store in resource would be a very good solution for complied scripts.

for not complied it could be Base64 encoded, like in some other script (ex. AutoitObject)

Excellent observation.

 

.

eMyvnE

Share this post


Link to post
Share on other sites

@jscript

Yes Base64 is a better choice then Hex format. It just need 4 Bytes to save 3 Bytes binary data

See here or

@trancexx

Thanks. It's a pleasure to read such excellent scripts

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I wanted to try this out, but wasnt sure about what the options and text was saying. I saw that you needed some translation, so I played around with the translate in Google. I copied your text into a language file and created a select based on your OSLang return value. I only did the original Portuguese and the additional English (You may want to do it a different way). Anyway, I modified the original file slightly to use all the variables that are setup in the language file.

Now I can check it out and see if it work for me :graduated:

Attaching files

CreateFilesEmbedded.au3

language.au3

Edited by Reaper HGN

Share this post


Link to post
Share on other sites

Great UDF!

Can't wait for the new version :D

Share this post


Link to post
Share on other sites

Hi, I played around with the translation file as you will not get something on the screen to read if your system has another language set (like german).

Hopefully I will have same spare time during the next couple of days I will translate it to german also.

Greetings RW

#include ".\Include\_GetOSLangString.au3"

$SysLang = _GetOSLangString(@OSLang)
Global $a_language[24]

If StringInStr($SysLang, "Portuguese", False) Then

  $a_language[1] = "Opções do arquivo de saída."
  $a_language[2] = "Criar uma função baseada no nome de saída."
  $a_language[3] = "Adicionar padrões de Funções Definidas pelo Usuário (UDF)."
  $a_language[4] = "Apenas criar o arquivo de saída com o binário."
  $a_language[5] = "Adicionar compressão  LZNT nativa do Windows."
  $a_language[6] = "Nível de compressão:"
  $a_language[7] = "&Abrir arquivo"
  $a_language[8] = "Embutir arquivo"
  $a_language[9] = "Testar"
  $a_language[10] = "Padrão"
  $a_language[11] = "Progresso de conversão:"
  $a_language[12] = "Sair"
  $a_language[13] = "Linhas convertidas:"
  $a_language[14] = "Escolha um arquivo para embutir:"
  $a_language[15] = "O arquivo "
  $a_language[16] = " não existe!"
  $a_language[17] = 'O teste somente com a opção: "Criar uma função baseada no nome de saída" ativada!'
  $a_language[18] = "Aguarde, criando o arquivo .AU3 -> "
  $a_language[19] = "Salvar o arquivo embutido como"
  $a_language[20] = "Compactando o arquivo, aguarde..."
  $a_language[21] = " - Concluído!"
  $a_language[22] = 'O arquivo "'
  $a_language[23] = '" foi embutido para au3.'

Else ;"English"

  $a_language[1] = "Options for the output file."
  $a_language[2] = "Create a function based on the output name."
  $a_language[3] = "Adding patterns of User Defined Functions (UDF)."
  $a_language[4] = "Only create the output file with the binary."
  $a_language[5] = "Adding compression LZNT native Windows."
  $a_language[6] = "Compression level"
  $a_language[7] = "&Open File"
  $a_language[8] = "Embedding file"
  $a_language[9] = "Test"
  $a_language[10] = "Standard"
  $a_language[11] = "Progress of conversion:"
  $a_language[12] = "Exit"
  $a_language[13] = "Converted Lines"
  $a_language[14] = "Choose a file to embed"
  $a_language[15] = "File"
  $a_language[16] = "No!"
  $a_language[17] = 'The test only with the option: "Create a function based on the output name" activated!'
  $a_language[18] = "Wait, creating the file. AU3 equipment ->"
  $a_language[19] = "Save the file as built"
  $a_language[20] = "Compressing the file, wait ..."
  $a_language[21] = "- Done!"
  $a_language[22] = 'File" '
  $a_language[23] = '"AU3 equipment was built for."'

EndIf

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Tested and approved, much better than FileInstall () thanks for sharing.

Edited by Belini

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
Sign in to follow this  
Followers 0

  • Similar Content

    • Beege
      Embed Full Compressed Directorys in Script using LZF and Base64
      By Beege
      This is a small UDF I put together just for fun that will embed and extract complete directory's in and from your script. It only has two functions, _EmbeddedDirectory_Create() and _EmbeddedDirectory_Extract(). The udf uses Wards machine code functions so they have pretty good speed. The example I set up packs all files located in Autoit Include directory. Both compression and decompression of the directory was less than 500ms on my pc which I was happy with. Let me if you have any problems or questions. Thanks
       
      Example:
       
      #include "EmbedDir.au3" ;Check location of autoit includes Global $sIncludeDir = 'C:\Program Files\AutoIt3\Include\' If Not FileExists($sIncludeDir) Then $sIncludeDir = 'C:\Program Files (x86)\AutoIt3\Include\' If Not FileExists($sIncludeDir) Then Exit (MsgBox(0, 'Directory Not Found', 'Unable to locate Includes Directory')) ;Create embedded directory function Global $sCompressed_Includes = _EmbeddedDirectory_Create($sIncludeDir, '_Extract_Includes') Global $iTime = (@extended / 1000) & ' ms' ;create example file and write extract function to it Global $hExtractExample = FileOpen(@ScriptDir & 'Extract_Example.au3', 2) FileWrite($hExtractExample, '#include "EmbedDir.au3"' & @LF & @LF & _ '$sExt = _Extract_Includes()' & @LF & _ '_EmbeddedDirectory_Extract($sExt, @ScriptDir & "AutoIt_Extracted")' & @LF & _ 'ConsoleWrite("Extract Time = " & @extended/1000 & "ms" & @LF)' & @LF & @LF & _ $sCompressed_Includes) FileClose($hExtractExample) ;Show stats of the directory we just embeded $aSize = DirGetSize($sIncludeDir,1) If IsArray($aSize) Then Msgbox(0,"Directory Details", _ "Size = " & Int($aSize[0]/1024) & 'KB' & @LF & _ "Files = " & $aSize[1] & @LF & _ "Dirs = " & $aSize[2] & @LF & _ "Compression time = " & $iTime & @LF & @LF & _ "Open Extract_Example.au3 to extract") EndIf  
      UDF:
      EmbedDir.zip
    • wakillon
      Bitmap2Svg
      By wakillon
      Do not expect a SVG file as Sodipodi, Inkscape or Adobe Illustrator can generate.
      This "converter" doesn't actually trace or convert the image to vector. 
      It just embed the bitmap image within an SVG container.
      #Region ;************ Includes ************ #Include <GDIPlus.au3> #Include <Memory.au3> #EndRegion ;************ Includes ************ Global $_B64E_CodeBuffer, $_B64E_CodeBufferMemory, $_B64E_Init, $_B64E_EncodeData, $_B64E_EncodeEnd Global $sFile, $hImage, $iW, $iH, $sType, $hFile, $sBase64String, $sFileRead, $sSvgPath, $sString _GDIPlus_Startup() $sFile = FileOpenDialog ( 'Select an Image', @DesktopDir, 'Images (*.jpg;*.png;*.gif;*.bmp)', 1+2 ) If @error Then Exit $sType = _FileGetType ( $sFile ) If @error Then ConsoleWrite ( '! File Type not supported, error : ' & @error & @Crlf ) Else $hFile = FileOpen ( $sFile, 16 ) If $hFile=-1 Then Exit MsgBox ( 262144+4096+16, 'Error', 'Can not Access this file.', 4 ) $hImage = _GDIPlus_ImageLoadFromFile ( $sFile ) $iW = _GDIPlus_ImageGetWidth ( $hImage ) $iH = _GDIPlus_ImageGetHeight ( $hImage ) _GDIPlus_ImageDispose ( $hImage ) $sFileRead = FileRead ( $hFile ) FileClose ( $hFile ) $sBase64String = _Base64Encode ( $sFileRead, 4000 ) $sString = '<svg' & @CRLF & _ ' version="1.1"' & @CRLF & _ ' xmlns="http://www.w3.org/2000/svg"' & @CRLF & _ ' xmlns:xlink="http://www.w3.org/1999/xlink"' & @CRLF & _ ' width="' & $iW & 'px" height="' & $iH & 'px"' & @CRLF & _ ' viewBox="0 0 ' & $iW & ' ' & $iH & '" preserveAspectRatio="none">' & @CRLF & _ ' <g>' & @CRLF & _ '<image width="' & $iW & '" height="' & $iH & '" xlink:href="data:image/' & $sType & ';base64,' & @CRLF & _ $sBase64String & @CRLF & _ '"/>' & @CRLF & _ ' </g>' & @CRLF & _ '</svg>' & @CRLF $sSvgPath = @TempDir & '\' & @HOUR & @MIN & @SEC & @MSEC & '-' & $iW & 'x' & $iH & '.svg' $hFile = FileOpen ( $sSvgPath, 1+2+8 ) If $hFile = -1 Then MsgBox ( 262144+4096+16, '', 'An error occurred whilst writing the temporary file.' ) Else FileWrite ( $hFile, $sString ) FileClose ( $hFile ) ShellExecute ( 'iexplore.exe', $sSvgPath ) EndIf EndIf _GDIPlus_Shutdown() Exit Func _FileGetType ( $sFilePath ) If Not FileExists ( $sFilePath ) Then Return SetError ( -1 ) If FileGetSize ( $sFilePath ) = 0 Then Return SetError ( 1, 0, 0 ) Local $hFile, $Binary, $Ret $hFile = FileOpen ( $sFilePath, 16 ) If $hFile = -1 Then Return SetError ( 3, 0, 0 ) $Binary = FileRead ( $hFile ) FileClose ( $hFile ) Local $sString = StringTrimLeft ( $Binary, 2 ) Local $sStringLeft = StringReplace ( StringTrimLeft ( StringLeft ( $Binary, 14 ), 2 ), '00', '' ) Local $sStringLeft12 = StringLeft ( $sStringLeft, 12 ) Local $sStringLeft8 = StringLeft ( $sStringLeft, 8 ) Local $sStringLeft4 = StringLeft ( $sStringLeft, 4 ) Select Case $sStringLeft12 = '474946383961' Or $sStringLeft12 = '474946383761' $Ret = 'GIF' Case $sStringLeft4 = 'FFD8' $Ret = 'JPG' Case $sStringLeft4 = '424D' $Ret = 'BMP' Case $sStringLeft8 = '89504E47' $Ret = 'PNG' Case Else Return SetError ( 2, 0, '' ) EndSelect If $Ret = 'GIF' Then StringReplace ( $sString, '0021F904', '0021F904' ) If @extended > 1 Then Return SetError ( 3, 0, '' ) ; animated gif. EndIf Return $Ret EndFunc ;==> _FileGetType() Func _Base64E_Exit() ; by Ward $_B64E_CodeBuffer = 0 _MemVirtualFree ( $_B64E_CodeBufferMemory, 0, $MEM_RELEASE ) EndFunc ;==> _Base64E_Exit() Func _Base64Encode ( $Data, $LineBreak=76 ) ; by Ward Local $State = _Base64EncodeInit ( $LineBreak ) Return _Base64EncodeData ( $State, $Data ) & _Base64EncodeEnd ( $State ) EndFunc ;==> _Base64Encode() Func _Base64EncodeData ( ByRef $State, $Data ) ; by Ward If Not IsDllStruct ( $_B64E_CodeBuffer ) Or Not IsDllStruct ( $State ) Then Return SetError ( 1, 0, '' ) $Data = Binary ( $Data ) Local $InputLen = BinaryLen ( $Data ) Local $Input = DllStructCreate ( 'byte[' & $InputLen & ']' ) DllStructSetData ( $Input, 1, $Data ) Local $OputputLen = Ceiling ( BinaryLen ( $Data )*1.4 )+3 Local $Output = DllStructCreate ( 'char[' & $OputputLen & ']' ) DllCall ( 'user32.dll', 'int', 'CallWindowProc', 'ptr', DllStructGetPtr ( $_B64E_CodeBuffer )+$_B64E_EncodeData, 'ptr', DllStructGetPtr ( $Input ), 'uint', $InputLen, 'ptr', DllStructGetPtr ( $Output ), 'ptr', DllStructGetPtr ( $State ) ) Return DllStructGetData ( $Output, 1 ) EndFunc ;==> _Base64EncodeData() Func _Base64EncodeEnd ( ByRef $State ) ; by Ward If Not IsDllStruct ( $_B64E_CodeBuffer ) Or Not IsDllStruct ( $State ) Then Return SetError ( 1, 0, '' ) Local $Output = DllStructCreate ( 'char[5]' ) DllCall ( 'user32.dll', 'int', 'CallWindowProc', 'ptr', DllStructGetPtr ( $_B64E_CodeBuffer ) + $_B64E_EncodeEnd, 'ptr', DllStructGetPtr ( $Output ), 'ptr', DllStructGetPtr ( $State ), 'int', 0, 'int', 0 ) Return DllStructGetData ( $Output, 1 ) EndFunc ;==> _Base64EncodeEnd() Func _Base64EncodeInit ( $LineBreak=76 ) ; by Ward If Not IsDllStruct ( $_B64E_CodeBuffer ) Then If @AutoItX64 Then Local $Opcode = '0x89C08D42034883EC0885D2C70100000000C64104000F49C2C7410800000000C1F80283E20389410C740683C00189410C4883C408C389C94883EC3848895C242848897424304889CB8B0A83F901742083F9024889D87444C6000A4883C001488B74243029D8488B5C24284883C438C30FB67204E803020000BA3D0000004080FE3F7F08480FBEF60FB614308813C643013D488D4303C643023DEBBC0FB67204E8D7010000BA3D0000004080FE3F7F08480FBEF60FB614308813C643013D488D4302EB9489DB4883EC68418B014863D248895C242848897424304C89C348897C24384C896424484C89CE83F80148896C24404C896C24504C897424584C897C24604C8D2411410FB6790474434D89C64989CD0F82F700000083F8024C89C5747B31C0488B5C2428488B742430488B7C2438488B6C24404C8B6424484C8B6C24504C8B7424584C8B7C24604883C468C34C89C54989CF4D39E70F840B010000450FBE374D8D6F014489F025F0000000C1F80409C7E8040100004080FF3FBA3D0000007F08480FBEFF0FB614384489F78855004883C50183E70FC1E7024D39E50F84B2000000450FB675004983C5014489F025C0000000C1F80609C7E8BD0000004080FF3FBA3D0000007F08480FBEFF0FB61438BF3F0000008855004421F74C8D7502E896000000480FBED70FB604108845018B460883C0013B460C89460875104C8D7503C645020AC7460800000000904D39E5742E410FBE7D004D8D7D01498D6E01E8560000004889FA83E70348C1EA02C1E70483E23F0FB60410418806E913FFFFFF4489F040887E04C7060000000029D8E9CCFEFFFF89E840887E04C7060200000029D8E9B9FEFFFF89E840887E04C7060100000029D8E9A6FEFFFFE8400000004142434445464748494A4B4C4D4E4F505152535455565758595A6162636465666768696A6B6C6D6E6F707172737475767778797A303132333435363738392B2F58C3' Else Local $Opcode = '0x89C08B4C24088B44240489CAC1FA1FC1EA1E01CAC1FA0283E103C70000000000C6400400C740080000000089500C740683C20189500CC2100089C983EC0C8B4C2414895C24048B5C2410897424088B1183FA01741D83FA0289D87443C6000A83C0018B74240829D88B5C240483C40CC210000FB67104E80C020000BA3D00000089F180F93F7F0989F20FBEF20FB6143088138D4303C643013DC643023DEBBD0FB67104E8DF010000BA3D00000089F180F93F7F0989F20FBEF20FB6143088138D4302C643013DEB9489DB83EC3C895C242C8B5C244C896C24388B542440897424308B6C2444897C24348B030FB6730401D583F801742D8B4C24488954241C0F820101000083F80289CF747D31C08B5C242C8B7424308B7C24348B6C243883C43CC210008B4C244889D739EF0F84400100008D57010FBE3F89542418894C241489F825F0000000C1F80409C6897C241CE8330100008B542418C644240C3D8B4C241489C789F03C3F7F0B0FBEF00FB604378844240C0FB644240C8D790188018B74241C83E60FC1E60239EA0F84CB0000000FB60A83C2018954241C89C825C0000000C1F80609C6884C2414E8D8000000BA3D0000000FB64C24148944240C89F03C3F7F0B0FBEF08B44240C0FB6143083E13F881789CEE8AD00000089F10FBED18D4F020FB604108847018B430883C0013B430C894308750EC647020A8D4F03C7430800000000396C241C743A8B44241C8B7C241C0FBE30894C241483C701E8650000008B4C241489F283E60381E2FC000000C1EA02C1E6040FB60410880183C101E9E4FEFFFF89F088430489C8C703000000002B442448E9B2FEFFFF89F189F8884B04C703020000002B442448E99CFEFFFF89F088430489C8C703010000002B442448E986FEFFFFE8400000004142434445464748494A4B4C4D4E4F505152535455565758595A6162636465666768696A6B6C6D6E6F707172737475767778797A303132333435363738392B2F58C3' EndIf $_B64E_Init = ( StringInStr ( $Opcode, '89C0' )-3 ) / 2 $_B64E_EncodeData = ( StringInStr ( $Opcode, '89DB' )-3 ) / 2 $_B64E_EncodeEnd = ( StringInStr ( $Opcode, '89C9' )-3 ) / 2 $Opcode = Binary ( $Opcode ) $_B64E_CodeBufferMemory = _MemVirtualAlloc ( 0, BinaryLen ( $Opcode ), $MEM_COMMIT, $PAGE_EXECUTE_READWRITE ) $_B64E_CodeBuffer = DllStructCreate ( 'byte[' & BinaryLen ( $Opcode ) & ']', $_B64E_CodeBufferMemory ) DllStructSetData ( $_B64E_CodeBuffer, 1, $Opcode ) OnAutoItExitRegister ( '_Base64E_Exit' ) EndIf Local $State = DllStructCreate ( 'byte[16]' ) DllCall ( 'user32.dll', 'none', 'CallWindowProc', 'ptr', DllStructGetPtr ( $_B64E_CodeBuffer )+$_B64E_Init, 'ptr', DllStructGetPtr ( $State ), 'uint', $LineBreak, 'int', 0, 'int', 0 ) Return $State EndFunc ;==> _Base64EncodeInit() Thanks to Ward for his Base64 functions.
    • TheDcoder
      Help with inserting Null in a Base64 string
      By TheDcoder
      I am really having a headache with this one...
      ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Base64_Encode ; Description ...: Encode the $vData in Base64 ; Syntax ........: _Base64_Encode($vData) ; Parameters ....: $vData - $vData to Encode. ; Return values .: Success: Base64 encoded $vData in the form of a string. ; Failure: False and @error set to: ; 1 - If "error calculating the length of the buffer needed" ; 2 - If "error encoding" ; Author ........: trancexx ; Modified ......: Damon Harris (TheDcoder) ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Base64_Encode($vData) $vData = Binary($vData) Local $tByteStruct = DllStructCreate("byte[" & BinaryLen($vData) & "]") DllStructSetData($tByteStruct, 1, $vData) Local $tIntStruct = DllStructCreate("int") Local $aDllCall = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($tByteStruct), _ "int", DllStructGetSize($tByteStruct), _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($tIntStruct)) If @error Or Not $aDllCall[0] Then Return SetError(1, 0, False) ; error calculating the length of the buffer needed EndIf Local $tCharStruct = DllStructCreate("char[" & DllStructGetData($tIntStruct, 1) & "]") $aDllCall = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($tByteStruct), _ "int", DllStructGetSize($tByteStruct), _ "int", 1, _ "ptr", DllStructGetPtr($tCharStruct), _ "ptr", DllStructGetPtr($tIntStruct)) If @error Or Not $aDllCall[0] Then Return SetError(2, 0, False) ; error encoding EndIf Return DllStructGetData($tCharStruct, 1) EndFunc ConsoleWrite(_Base64_Encode("jilles" & Null & "jilles" & Null & "sesame")) ; It should be "amlsbGVzAGppbGxlcwBzZXNhbWU=" Sleep(1000)
       
      Thanks in Advance, TD.
    • CSL
      How to get arbitrary section of bits from a binary
      By CSL
      I want to take a binary data from any source (string,number,files,etc..) and iterate over each X bits of it in a loop, say take bits 1-5, then 6-10, etc.. Then I want to convert these bits to their corresponding decimal value.
      but all the binary functions I found in autoit only work with full bytes, and do not let me get smaller sections of bits, like "BinaryMid()" that "Extracts a number of bytes from a binary variant"
      Can anyone tell me if this is possible to do and how? and also if there is a function to convert those bits to/from decimals?
      I'm not that familiar with dealing directly with binary, so any help or tips will be very appreciated
      Context:
      I'm trying to make a function to encode/decode any given binary data into/from a given array of characters. just like Base64 but using different bases then [a-z A-Z 0-9 +/= ]. My approach currently is to figure out how many bits of binary I can encode with each character, read those bits and convert them to a decimal number, then I will use that number as an index and take the character at that index from the character array and add it to the result string.
      I'm aware that there may be some padding needed.
       
       
    • AmarokStudios
      Display Outlooks Content With _IECeateEmbedded
      By AmarokStudios
      Hello all! I'm trying to figure out how to display the contents of my Microsoft Outlooks inbox inside of an AutoIt GUI.
       
      So far, I've managed to embed it perfectly and the website looks fantastic, but whenever I click on a message in my inbox, I can't view it. I also can't create new messages or search my inbox. I figured this was probably an ActiveX or JavaScript incompatibility. Any ideas?
       
      Local $oIE = _IECreateEmbedded() $browserObj = GUICtrlCreateObj($oIE, 20, 60, 780, 580) _IENavigate($oIE, "https://outlook.office.com/owa/#path=/mail")