Script Example: Base64 Encoding Files

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Script Example: Base64 Encoding Files

Post by CyberCitizen » Mon Jun 24, 2013 5:58 am

Hey Guys,

Just a quick little script I use when I want to save files, programs etc within a script to make it portable.

Thanks to Dick Lockey's post here, I modified it a little to put the code into clipboard once done, you can then paste the full code in say a SubRoutine and call it when you need that file extracted.

Image

Code: Select all

Input>filename,Browse to Select a file for Base64 encoding
ExtractFileName>%filename%,strFileName
ReadFile>filename,filedata
Base64>filedata,Encode,b64data
PutClipBoard>Let>SomeVariable=%b64data%%CRLF%Base64>SomeVariable,Decode,BinaryData%CRLF%Let>WLN_NOCRLF=1%CRLF%WriteLn>%TEMP_DIR%%strFileName%,wres,BinaryData
The only thing I wasn't sure on is how to have it write %TEMP_DIR% instead of actually returning the variables path.
FIREFIGHTER

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Mon Jun 24, 2013 12:11 pm

Nice example...thanks for sharing.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts