Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ;script !gameinfo Script
- ;version Jan2014
- ;author mruno
- ;email mruno@ircN.org
- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ;
- ;added xboxOne and ps4 support
- ;
- on *:TEXT:*:#: {
- if ($1 == !gamerank) || ($1 == !gameinfo) {
- ;if (m isin $chan(#).mode) { .timerG. $+ $nick 1 5 .notice $nick Script is OFF due to channel being mdoerated (+m). | halt }
- if (!$findtok(%gamerank,$nick,0,46)) {
- set -u10 %gamerank $addtok(%gamerank,$nick,46)
- var %a = gamerank
- h %a chan $chan
- h %a cid $cid
- h %a nick $nick
- h %a network $network
- game $nick $2-
- }
- else .timerG. $+ $nick 1 5 .notice $nick Please wait 10 seconds and try again...
- }
- }
- on *:INPUT:#:{
- if ($1 == !gamerank) || ($1 == !gameinfo) {
- ;if (m isin $chan(#).mode) { .notice $nick Script is OFF due to channel being mdoerated (+m). | halt }
- var %a = gamerank
- h %a chan $chan
- h %a network $network
- h %a cid $cid
- h %a nick $me
- game $me $2-
- }
- }
- alias -l game {
- ;if ($1 != $me) echo -st gamerank $1-
- if (!$window(@Queue_game)) {
- .qmake game
- .qstart game 500
- }
- if (!$2) {
- var %cmd = .qadd game .notice $1
- %cmd !GameRanking by mruno. Usage: !gameinfo [options] [category] <search>
- %cmd Options:
- %cmd List Results: -lN (where N is the number of results to list). Maximum of 5 results.
- %cmd Search by year: -yN (where N is the year). Example: "!game -l5y2004 Skyrim" - top 5 results for 'skyrim' in 2004.
- %cmd Sorting: -sN (where N is the type of sorting) Types: Best (default), Worst, A, Z, New, Old. Example: "!game -sNew xbox360" - Newest game for xbox 360.
- %cmd Categories: 3DS, Dreamcast, DS, Gameboy, GBA, GBC, Gamecube, Genesis, iPhone, Mac, Mobile, Ngage, N64, PC, PS, PS2, PS3, PS4, Vita, PSP, Saturn, SegaCD, SNES, Wii, WiiU, Xbox, Xbox360, XboxOne
- %cmd Example: " $+ $1 -l5y2004 Skyrim" - top 5 results for 'skyrim' in 2004.
- }
- else {
- .timergamerank. $+ $1 1 30 .qadd game notice $h(gamerank,nick) Search timed out. Please try again.
- var %a, %b, %p, %u, %o, %year = 0, %sort = 0
- h gamerank sort Best
- var %options, %category, %query, %year
- h gamerank results 1
- h gamerank result 1
- if ($left($2,1) == -) {
- set %a $3
- set %options $right($2,-1)
- if (y isin %options) set %year $remove($mid(%options,$pos(%options,y),5),y)
- if (s isin %options) {
- if ($remove($mid(%options,$pos(%options,s),4),s) == Bet) h gamerank sort Best
- elseif ($remove($mid(%options,$pos(%options,s),6),s) == Wort) { h gamerank sort Worst | set %sort 1 }
- elseif ($remove($mid(%options,$pos(%options,s),2),s) == A) { h gamerank sort A-z | set %sort 2 }
- elseif ($remove($mid(%options,$pos(%options,s),2),s) == Z) { h gamerank sort Z-a | set %sort 3 }
- elseif ($remove($mid(%options,$pos(%options,s),4),s) == New) { h gamerank sort Newest | set %sort 4 }
- elseif ($remove($mid(%options,$pos(%options,s),4),s) == Old) { h gamerank sort Oldest | set %sort 5 }
- }
- if (l isin %options) {
- if ($remove($mid(%options,$pos(%options,l,1),2),l) isnum) h gamerank results $ifmatch
- elseif ($remove($mid(%options,$pos(%options,l,2),2),l) isnum) h gamerank results $ifmatch
- if ($h(gamerank,results) > 5) h gamerank results 5
- h gamerank result $h(gamerank,results)
- }
- }
- else {
- set %a $2
- set %b $replace($3-,$chr(32),+,.,+)
- }
- if (%a == 3ds) set %p %a
- elseif (%a == dreamcast) set %p %a
- elseif (%a == ds) set %p %a
- elseif (%a == gameboy) set %p %a
- elseif (%a == gba) set %p %a
- elseif (%a == gbc) set %p %a
- elseif (%a == gamecube) set %p %a
- elseif (%a == genesis) set %p %a
- elseif (%a == iphone) set %p %a
- elseif (%a == mac) set %p %a
- elseif (%a == mobile) set %p %a
- elseif (%a == ngage) set %p %a
- elseif (%a == n64) set %p %a
- elseif (%a == pc) set %p %a
- elseif (%a == ps) set %p %a
- elseif (%a == ps2) set %p %a
- elseif (%a == ps3) set %p %a
- elseif (%a == ps4) set %p %a
- elseif (%a == vita) set %p %a
- elseif (%a == psp) set %p %a
- elseif (%a == saturn) set %p %a
- elseif (%a == segacd) set %p %a
- elseif (%a == snes) set %p %a
- elseif (%a == wii) set %p %a
- elseif (%a == xbox) set %p %a
- elseif (%a == xbox360) set %p %a
- elseif (%a == xone) || (%a == xbone) || (%a == xboxone) || (%a == xbox1) set %p xboxone
- elseif (%a == wiiu) { set %p wii-u | set %a wii-u }
- else {
- if ($left($2,1) == -) set %b $replace($3-,$chr(32),+,.,+,-,+)
- else set %b $replace($2-,$chr(32),+,.,+,-,+)
- set %a $null
- }
- if (%a) hadd gamerank cat $upper(%a)
- h gamerank query $replace(%b,+,_,.,_)
- .qadd game notice $h(gamerank,nick) Searching for: $+ $h(gamerank,sort) %p $replace(%b,+,$chr(32))
- set %u http://www.gamerankings.com/browse.html?site= $+ %a $+ &cat=0&year= $+ %year $+ &numrev=3&sort= $+ %sort $+ &letter=&search= $+ %b
- h gamerank u %u
- gdownload complete %u gamerank.txt
- ;echo -a ------ %u ---------------
- .timergameinfo.gclean 0 60 gameinfo.gclean
- }
- }
- alias -l complete {
- if ($1 == 1) && ($2 == S_OK) {
- var %a = @game, %b, %c, %d = 0, %e, %z = 0, %t, %e, %noresults = 0
- while (%z < $h(gamerank,results)) {
- inc %z
- h gamerank no %z
- if ($window(%a)) window -c %a
- window -h %a
- loadbuf %a gamerank.txt
- if ($fline(@game,*No results were found for your search*,1)) inc %noresults
- else dline %a 1- $+ $fline(%a,*"pod"*,1)
- set %b $fline(@game,*href=*,%z)
- if (!%b) || (%noresults) {
- .qadd game $iif($h(gamerank,nick) == $me,notice $me,msg $h(gamerank,chan)) No results found for: $+ $replace($h(gamerank,query),_,$chr(32))
- .qadd game gameinfo.gclean
- .timergamerank.* off
- return
- }
- set %t game. $+ $h(gamerank,query) $+ %z
- set %c $striphtml($line(%a,$calc(%b + 1)))
- set %d $gettok(%c,0,44)
- if ($remove($gettok(%c,%d,44),$chr(32),) isnum) set %e $ifmatch
- else set %e n/a
- h %t platform $striphtml($line(%a,$calc(%b - 1)))
- h %t url www.gamerankings.com $+ $remove($gettok($line(@game,%b),2,34),index.html)
- h %t name $striphtml($line(@game,%b))
- h %t year %e
- h %t dev $gettok(%c,1 - $calc(%d - 1),44)
- h %t rating $iif($remove($gettok($striphtml($line(%a,$calc(%b + 2))),1,32),$chr(37)) isnum,$ifmatch,n/a)
- h %t reviews $iif($gettok($striphtml($line(%a,$calc(%b + 2))),2,32) isnum,$ifmatch,n/a)
- window -c %a
- if ($h(gamerank,result) > 1) {
- var %cmd, %date, %echo
- set %echo $+ $h(%t,platform) Game: $h(%t,name) $iif($h(gamerank,result) > 1,Date: %e) ( $+ $h(%t,url) $+ )
- if ($h(gamerank,nick) != $me) set %cmd .qadd game msg $h(gamerank,chan)
- else set %cmd noop
- %cmd %echo
- echo -t $h(gamerank,chan) %echo
- }
- }
- if ($h(gamerank,result) == 1) gdownload ginfo http:// $+ $h(%t,url) gamerank $+ %z $+ .txt
- else { window -c %w | .qadd game gameinfo.gclean }
- }
- else {
- .timergamerank.* off
- .qadd game $iif($h(gamerank,nick) == $me,notice $me,msg $h(gamerank,chan)) Error downloading data. See $h(gamerank,u)
- }
- }
- alias -l h {
- if (!$2) { echo -a error: no 2 for hash table | return }
- if (!$hget($1)) hmake $1 10
- if ($isid) return $hget($1,$2)
- else hadd $1 $2 $3-
- }
- alias -l ginfo {
- if ($2 == Connect_Error) { .qadd game msg $iif($h(gamerank,nick) == $me,$me,$h(gamerank,chan)) Error downloading data. See $+ $h(%b,url) | .timergamerank.* off }
- elseif ($1 == 1) && ($2 == S_OK) {
- var %w = @game. $+ $h(gamerank,no)
- if ($window(%w)) window -c %w
- window -h %w
- loadbuf %w $4-
- var %a = 1, %b, %c = 0, %d, %o, %date, %cmd, %echo
- while ($hget(game. $+ $hget(gamerank,query) $+ %a)) {
- inc %c
- set %b $hget(game. $+ $hget(gamerank,query) $+ %a)
- set %d $striphtml($line(%w,$calc($fline(%w,*Release Date:*,1) -1)))
- if ($hget(gamerank,results) == 1) set %d $gettok(%d,1-48,32) $+ $iif($gettok(%d,0,32) > 48,...)
- if ($hget(gamerank,results) > 1) set %d $gettok(%d,1-32,32) $+ $iif($gettok(%d,0,32) > 32,...)
- if ($h(gamerank,nick) != $me) set %cmd .qadd game msg $h(gamerank,chan)
- else set %cmd noop
- set %date $gettok($gettok($striphtml($line(%w,$fline(%w,*Release Date:*,1))),1,47),2,58)
- set %echo $+ $h(%b,platform) Game: $h(%b,name) ( $+ $h(%b,url) $+ )
- %cmd %echo
- if (%echo) .timergamerank.* off
- echo $h(gamerank,chan) %echo
- set %echo Release Date: %date Publisher/Developer: $h(%b,dev)
- %cmd %echo
- echo $h(gamerank,chan) %echo
- if (%d) {
- set %echo Info: %d
- %cmd %echo
- echo $h(gamerank,chan) %echo
- }
- set %o $remove($striphtml($line(%w,$calc($fline(%w,*Also on...*,1)+3))),/div)
- if (%o) {
- set %echo Also on: %o
- %cmd %echo
- echo $h(gamerank,chan) %echo
- }
- var %r = $h(%b,rating)
- if (%r != n/a) {
- set %echo Rating: $chr(91) $+ $iif(%r > 5.55,12,) $+ * $+ $iif(%r > 15.55,12,) $+ * $+ $iif(%r > 25.55,12,) $+ * $+ $iif(%r > 35.55,12,) $+ * $+ $iif(%r > 45.55,12,) $+ * $+ $iif(%r > 55.55,12,) $+ * $+ $iif(%r > 65.55,12,) $+ * $+ $iif(%r > 75.55,12,) $+ * $+ $iif(%r > 85.55,12,) $+ * $+ $iif(%r > 95.55,12,) $+ *] %r $+ $chr(37) $paren($h(%b,reviews) reviews)
- %cmd %echo
- echo $h(gamerank,chan) %echo
- }
- inc %a
- if (%a > $hget(gamerank,results)) break
- }
- window -c %w
- .qadd game gameinfo.gclean
- }
- else { .qadd game msg $iif($h(gamerank,nick) == $me,$me,$h(gamerank,chan)) Error downloading data. See $+ $h(%b,url) | .timergamerank.* off }
- }
- alias -l gameinfo.gclean {
- ;this removes the hash tables that were used AND closes @game
- if (%gamerank) { .timergameinfo.gclean 0 60 gameinfo.gclean | return }
- .timergameinfo.gclean off
- hfree -w game.*
- hfree -w gameinfo*
- hfree -w gamerank*
- set %r $findfile($mircdir,gamerank*.txt,0,1,.remove $1-)
- set %r $findfile($mircdir,gdownload*.vbs,0,1,.remove $1-)
- if ($window(@game)) window -c @game
- .timer 1 1 if ($window(@Queue_game)) .qfree game
- unset %gamerank
- }
- on 1:UNLOAD:{
- if ($window(@Queue_game)) .qfree game
- gameinfo.gclean
- }
- ;/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\
- ;/|\ Title : Commmand Queues v1.1 /|\
- ;/|\ Author : Nebuchadnezzar (Admin@monoChrome-Script.cjb.net) /|\
- ;/|\ mIRC : 6.1+ /|\
- ;/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\|/|\
- ; Description :
- ; Store commands in multiple queues with set delays.
- ; Introduction :
- ; This add-on allows you to create and fully manipulate your own
- ; command queues. While there are numerous possible uses for them,
- ; their most common use would be for flood buffers to prevent being
- ; disconnected from servers when sending a lot of commands at once
- ; (e.g. when pasting multiple lines of text at once). You can create
- ; as many queues as you like, so you can have different queues for
- ; different types of commands.
- ; Commands :
- ; /qmake <name>
- ; Creates a new queue.
- ; /qfree <name>
- ; Frees an existing queue.
- ; ;/qadd [-i <N>] <name> <item>
- ; Adds an item to an existing queue. If the -i switch is specified,
- ; the item is inserted as the Nth item.
- ; /qdel <N> <name>
- ; Deletes the Nth item from a queue.
- ; /qmove <N1> <N2> <name>
- ; Moves the N1st item in a queue to N2nd position.
- ; /qswitch <N1> <N2> <name>
- ; Switches the N1st and N2nd items in a queue.
- ; /qreplace <N> <name> <item>
- ; Replaces the Nth item in a queue with the new item.
- ; /qexec <N> <name>
- ; Executes the command for the Nth item in a queue.
- ; Note: The item will NOT be removed from the queue after
- ; execution.
- ; /qstart <name> <delay>
- ; Starts calling of commands from a queue with a delay in
- ; milliseconds.
- ; /qstop <name>
- ; Stops calling of commands from a queue.
- alias -l qcall {
- if ($line($1,0)) {
- .qexec 1 $2
- .qdel 1 $2
- }
- }
- alias -l _qerr {
- echo -ces Info * / $+ $1 $+ : $2-
- halt
- }
- alias -l _qexec $($1-,2)
- alias -l _qok echo -ces Info * $1-
- alias qmake {
- var %com = qmake
- if (!$1) _qerr %com insufficient parameters
- elseif (-* iswm $1) _qerr %com invalid queue ' $+ $1 $+ '
- var %win = @Queue_ $+ $1
- if ($window(%win)) _qerr %com queue ' $+ $1 $+ ' exists
- window -hn %win
- if ($show) _qok Made queue ' $+ $1 $+ '
- }
- alias qfree {
- var %com = qfree
- if (!$1) _qerr %com insufficient parameters
- var %win = @Queue_ $+ $1
- if (!$window(%win)) _qerr %com no such queue ' $+ $1 $+ '
- window -c %win
- .timerqueue_ [ $+ [ $1 ] ] off
- if ($show) _qok Freed queue ' $+ $1 $+ '
- }
- alias qadd {
- var %com = qadd
- if ($1 === -i) var %i = 1
- else var %i = 0
- if (((%i) && (!$4)) || ((!%i) && (!$2))) _qerr %com insufficient parameters
- var %win = @Queue_ $+ $iif(%i,$3,$1)
- if (!$window(%win)) _qerr %com no such queue ' $+ $iif(%i,$3,$1) $+ '
- $iif(%i,iline,aline) %win $iif(%i,$2) $iif(%i,$4-,$2-)
- if ($show) _qok Added item ' $+ $iif(%i,$4-,$2-) $+ ' to queue ' $+ $iif(%i,$3,$1) $+ ' $iif(%i,in $ord($iif($line(%win,0) < $2,$ifmatch,$2)) position)
- }
- alias -l qdel {
- var %com = qdel
- if (!$2) _qerr %com insufficient parameters
- elseif ($1 !isnum 1-) _qerr %com invalid parameters
- var %win = @Queue_ $+ $2
- if (!$window(%win)) _qerr %com no such queue ' $+ $2 $+ '
- elseif (!$line(%win,$1)) _qerr %com no such item ' $+ $1 $+ '
- dline %win $1
- if ($show) _qok Deleted item ' $+ $1 $+ ' from queue ' $+ $2 $+ '
- }
- alias -l qmove {
- var %com = qmove
- if (!$3) _qerr %com insufficient parameters
- elseif (($1 !isnum 1-) || ($2 !isnum 1-)) _qerr %com invalid parameters
- var %win = @Queue_ $+ $3
- if (!$window(%win)) _qerr %com no such queue ' $+ $3 $+ '
- var %n1 = $iif($line(%win,0) < $1,$ifmatch,$1)
- var %n2 = $iif($line(%win,0) < $2,$ifmatch,$2)
- var %line = $line(%win,%n1)
- dline %win %n1
- iline %win %n2 %line
- if ($show) _qok Moved $ord(%n1) item to $ord(%n2) position in queue ' $+ $3 $+ '
- }
- alias -l qswitch {
- var %com = qswitch
- if (!$3) _qerr %com insufficient parameters
- elseif (($1 !isnum 1-) || ($2 !isnum 1-)) _qerr %com invalid parameters
- var %win = @Queue_ $+ $3
- if (!$window(%win)) _qerr %com no such queue ' $+ $3 $+ '
- var %n1 = $iif($line(%win,0) < $1,$ifmatch,$1)
- var %n2 = $iif($line(%win,0) < $2,$ifmatch,$2)
- var %line = $line(%win,%n1)
- rline %win %n1 $line(%win,%n2)
- rline %win %n2 %line
- if ($show) _qok Switched $ord(%n1) item with $ord(%n2) item in queue ' $+ $3 $+ '
- }
- alias -l qexec {
- var %com = qexec
- if (!$2) _qerr %com insufficient parameters
- elseif ($1 !isnum 1-) _qerr %com invalid parameters
- var %win = @Queue_ $+ $2
- if (!$window(%win)) _qerr %com no such queue ' $+ $2 $+ '
- var %n = $iif($line(%win,0) < $1,$ifmatch,$1)
- tokenize 124 $line(%win,%n)
- _qexec $*
- if ($show) _qok Executed $ord(%n) item in queue ' $+ $mid(%win,8) $+ '
- }
- alias qstart {
- var %com = qstart
- if (!$2) _qerr %com insufficient parameters
- elseif ($2 !isnum 0-) _qerr %com invalid parameters
- var %win = @Queue_ $+ $1
- if (!$window(%win)) _qerr %com no such queue ' $+ $1 $+ '
- .timerqueue_ [ $+ [ $1 ] ] -mo 0 $2 qcall %win $1
- if ($show) _qok Started queue ' $+ $1 $+ ' with a delay of ' $+ $2 $+ ms'
- }
- alias -l qdelay {
- var %com = qdelay
- if (!$2) _qerr %com insufficient parameters
- elseif ($2 !isnum 0-) _qerr %com invalid parameters
- elseif (!$timer(queue_ [ $+ [ $1 ] ])) _qerr %com queue not started ' $+ $1 $+ '
- .timerqueue_ [ $+ [ $1 ] ] -mo 0 $2 qcall %win $1
- if ($show) _qok Changed delay to ' $+ $2 $+ ms' in queue ' $+ $1 $+ '
- }
- alias -l qstop {
- var %com = qstop
- if (!$1) _qerr %com insufficient parameters
- elseif (!$timer(queue_ [ $+ [ $1 ] ])) _qerr %com queue not started ' $+ $1 $+ '
- .timerqueue_ [ $+ [ $1 ] ] off
- if ($show) _qok Stopped queue ' $+ $1 $+ '
- }
- ;==================================================================================
- ;Author : fubar
- ;Function: $striphtml identifier
- ; This identifier strips html code from a string of text.
- ; Good for using when retrieving webpages within mirc.
- ;==================================================================================
- ;
- ;This identifier strips html code from a string of text. Good for using when retrieving webpages within mirc.
- ;
- ;Usage: $striphtml(html code)
- alias -l Xchr {
- var %return $regsubex($regsubex($1-,/&#x([A-F0-9]{1,2});/g,$chr($base($regml(\n),16,10))),/&#([0-9]{2});/g,$chr(\1))
- return $replacecs(%return,–,,·,·,»,»,«,«,Ü,Ü,ü,ü,Á,Á,á,á,É,$&
- É,é,é,Í,Í,í,í,Ó,Ó,ó,ó,Ñ,Ñ,ñ,ñ,Ú,Ú,ú,ú, ,$chr(32),$&
- æ,æ,",")
- }
- alias -l striphtml {
- ; making sure there are parameters to work with
- IF ($1) {
- ; Setting my variables. The %opt is set kind of funky
- ; all it does is combine <two><brackets> into 1 <twobrackets>, fewer loops this way
- ; also stripped tab spaces
- VAR %strip,%opt = <> $remove($1-,> <,><,$chr(9)) <>,%n = 2
- ; using $gettok() I checked the text in front of '>' (chr 62)
- ; then the second $gettok checks the text behind '<' (chr 60)
- ; so I'm extracting anything between >text<
- WHILE ($gettok($gettok(%opt,%n,62),1,60)) {
- ; take each peice of text and add it to the same variable
- %strip = %strip $ifmatch
- %strip = $replace(%strip,",")
- ; increase the variable so the while statement can check the next part
- INC %n
- }
- ; now that the loop has finished we can return the stripped html code
- RETURN $xchr(%strip)
- }
- }
- ;/download by SReject
- ;http://www.hawkee.com/snippet/9318/
- alias gDownload {
- if ($regex(Args,$1-,^-c (?|(?:"(?=.+")([^"]+)")|(\S+)) (\S+) (?|(?:"(?=.+")([^"]+)")|(\S+)) (\S+)$)) {
- var %callback = $regml(Args,1)
- var %url = $regml(Args,2)
- var %file = $qt($regml(Args,3))
- var %com = $regml(Args,4)
- var %r = $iif($comerr,1,$com(%com).result)
- .remove $qt($scriptdir $+ %com)
- if ($com(%com)) { .comclose %com }
- if (%r == -1) { %callback 1 S_OK %url $qt(%file) }
- elseif (%r == 1) { %callback 0 UnKnown_ComErr %url $qt(%file) }
- elseif (%r == 2) { %callback 0 IE6+_Needed %url $qt(%file) }
- elseif (%r == 3) { %callback 0 Connect_Error %url $qt(%file) }
- elseif (%r == 4) { %callback 0 Newer_ActiveX_Needed %url $qt(%file) }
- elseif (%r == 5) { %callback 0 Writefile_Error %url $qt(%file) }
- else { %callback 0 Unknown_Error %url $qt(%file) }
- }
- elseif ($1 != -c) {
- if ($isid) || (!$regex(Args,$1-,^(?|(?:"(?=.+")([^"]+)")|(\S+)) (\S+) (?|(?:"(?=.+")([^"]+)")|(\S+))$)) || ($regml(Args,0) != 3) { return }
- var %callback = $regml(Args,1)
- var %url = $qt($regml(Args,2))
- var %file = $qt($iif(: isin $regml(Args,3),$v2,$mircdir $+ $v2))
- var %com = gdownload $+ $ticks $+ .vbs
- var %s = $qt($scriptdir $+ %com)
- var %w = write %s
- %w on error resume next
- %w Set C = CreateObject("msxml2.xmlhttp.3.0")
- %w if (err.number <> 0) then
- %w err.clear
- %w set C = CreateObject("msxml2.xmlhttp")
- %w if (err.number <> 0) then
- %w err.clear
- %w set C = CreateObject("XMLHttpRequest")
- %w if (err.number <> 0) then wscript.quit(2)
- %w end if
- %w end if
- %w C.open "GET", %url $+ , false
- %w C.send
- %w if (err.number <> 0) then wscript.quit(3)
- %w set O = createobject("adodb.stream")
- %w if (err.number <> 0) then wscript.quit(4)
- %w O.type=1
- %w O.mode=3
- %w O.open
- %w O.write C.responsebody
- %w O.savetofile %file $+ ,2
- %w if (err.number <> 0) then wscript.quit(5)
- %w O.close
- %w wscript.quit(-1)
- .comopen %com WScript.Shell
- if ($comerr || !$comcall(%com,gdownload -c $qt(%callback) $noqt(%url) %file,run,1,bstr*,%s,uint,1,bool,true)) { goto error }
- return
- }
- :error
- if ($error) { reseterror }
- if ($isfile(%s)) { .remove %s }
- if ($com(%com)) { .comclose %com }
- }
Add Comment
Please, Sign In to add comment