Description
This code is used for embedding a file into a picture. The output file is located in the $mircdir and by default is named "output.EXT" (.EXT represents the respective picture extension).
Allowed file types
Uses
/_embed - Calls the embedding dialog
/_copy ,[,output file] - The alias for embedding the files.
Update
9/26 Added thumbnail support for the pictures chosen to store the files within.
8/27 Added a preview section in the dialog to view the output files. I also updated the /_copy alias to support mp3s now, and edited it slightly to allow custom output filenames.
8/25 mIRC now embeds the compressed file itself, instead of calling the cmd.exe. The alias name is now /_copy and not /embed_files, also.
alias _copy {
var %p = $gettok($1-,1,44),%r = $gettok($1-,2,44),%pe = $gettok(%p,$numtok(%p,46),46),%re = $gettok(%r,$numtok(%r,46),46)
var %pf = jpg png gif bmp,%rf = rar zip mp3 7z,%o = $iif($gettok($1-,3,44),$v1,output)
if ($isfile($qt(%p))) && ($isfile($qt(%r))) {
if ($istok(%pf,%pe,32)) {
if ($istok(%rf,%re,32)) {
var %r = $qt(%r),%e = $right(%p,3),%p = $qt(%p),%o = $qt($+($mircdir,%o,.,%e))
set %output_file $noqt(%o)
.copy -o %p %o | .copy -a %r %o
}
else return $input(You've chosen an invalid file,wo,Error)
}
else return $input(You've chosen an invalid picture file,wo,Error)
}
}
alias _embed {
if (!$dialog(embed)) dialog -mdtrs embed embed
}
dialog embed {
title "Embedding in pics"
size -1 -1 120 95
option dbu
box "Picture",1,5 5 110 25
edit "",2,10 15 80 10,autohs
button "...",3,95 15 15 10
box "Other",4,5 35 110 25
edit "",5,10 45 80 10,autohs
button "...",6,95 45 15 10
box "Output (no *.ext)",9,5 65 75 25
edit "<optional>",10,10 75 65 10,autohs
link "View File",7,90 68 30 10,disabled
link "Embed File",8,87 82 30 10
box "Preview",11,120 5 75 85
icon 12,123 10 70 80
}
on *:dialog:embed:*:*:{
if ($devent == sclick) {
if ($did == 3) did -ra embed 2 $$sfile($mircdir $+ *.jpg;*.bmp;*.png;*.gif,Picture)
if ($did == 6) did -ra embed 5 $$sfile($mircdir $+ *.rar;*.zip;*.7z;*.mp3,Other)
if ($did == 7) if (%output_file) run $+(file://,%output_file)
if ($did == 8) {
if ($did($dname,2).text) && ($did($dname,5).text) {
if ($did($dname,10).text) && ($v1 != <optional>) var %o = $v1
var %files = $+($did($dname,2),$chr(44),$did($dname,5)) $+ $iif(%o,$+($chr(44),%o))
_copy %files
if (!$did($dname,7).enabled) did -e $dname 7
if (%output_file) pre.pic $qt(%output_file))
}
else return $input(You must select a picture and file to be embedded,wo,Error)
}
}
if ($devent == close) if (%output_file) unset %output_file
}
alias pre.pic {
if ($isfile($1-)) {
if ($dialog(embed)) dialog -bs embed -1 -1 200 95
window -dhw0p +L @pre -1 -1 135 170
drawpic -s @pre -1 -1 $window(@pre).w $window(@pre).h $1-
var %fn = $nopath($noqt($1-)),%ext = $gettok(%fn,$numtok(%fn,46),46),%next = $gettok(%fn,$iif($calc($numtok(%fn,46) - 1) <= 1,1,$v1), 46))
if ($len(%fn) > 20) var %fn = $left(%fn, $calc(15 - $calc($len(%ext) + 1)) - $len(%fn)),%formatted = $+(%fn,...,%ext)
else var %formatted = %fn
drawtext -o @pre 00 tahoma 12 10 10 %formatted
drawsave @pre temp_pre.bmp
window -c @pre
if ($dialog(embed)) did -g embed 12 temp_pre.bmp
.remove temp_pre.bmp
}
}
Here's a link, EL.
http://quantumrook.wordpress.com/2007/06/06/hide-a-rar-file-in-a-jpg-file/
Description
This code is used for embedding a compressed file into a picture file. A single-line *.bat file is created to preform the embedding process. The output file is located in the $mircdir and is named "output.EXT" (.EXT represents the respective picture extension).
O_O you may have to be a tad bit more clear.`-.-´