Snippets Project Page
Author: entropy
Added: 5y
Updated: 5y
mIRC: 7.52+
Hits: 1,260
Downloads: 22
Review: entropy
Size: 1.26KB
1 0
Login to vote.
Image Downloader
v1.3
THis snippet downloads binary files.
Download
JSON
▲ Review
▼ Source
; Image Downloader v1.3 - SplitFire & entropy 2018 ; Syntax: /image ; For SSL, use: /sockopen -e dimage www.mirc.com 443 ; Else use: /sockopen dimage www.mirc.com 80 alias image { sockopen -e dimage www.mirc.com 443 | write -c $qt($scriptdirindexlogo.gif) } on *:sockopen:dimage:{ sockwrite -nt $sockname GET /images/indexlogo.gif HTTP/1.1 sockwrite -nt $sockname Host: www.mirc.com sockwrite -nt $sockname $str($crlf,2) } on *:sockread:dimage:{ ;- if the socket isn't marked, proceed with the sockread normally if (!$sock($sockname).mark) { var %read | sockread %read ;- If sockread is blank (null), mark the socket so that it starts downloading what follows (on the next read) if (%read == $null) { echo -a *** Downloading... | sockmark $sockname 1 } } ;- Socket is marked, we just passed the blank line, start downloading from here ;- Save the file in $mircdir with the same name it had on the website else { sockread &image | bwrite $qt($scriptdirindexlogo.gif) -1 -1 &image } } on *:sockclose:dimage:{ echo -a *** Download complete. echo -a *** File Size: $bytes($file($qt($scriptdirindexlogo.gif)).size).suf run $qt($scriptdirindexlogo.gif) }
Changelog:
0
0