Jump to content

Screenshot Uploader Help :)


Jagie

Recommended Posts

on *:sockopen:upload*:{
  if ($sockerr) {
    .signal -n i.fail $sock($sockname).mark
    sockclose $sockname
  }
  else {
    var %i $md5($sockname), %img $sock($sockname).mark, %ext $regex(%img,/\.(\w+)$/), %ext $regml(1)
    bread $qt(%img) 0 $file($qt(%img)).size &img
    bset -t &cont 1 -- $+ %i $+ $crlf $+ Content-Disposition: form-data $+ $chr(59) name="fileupload" $+ $chr(59) filename=" $+ $nopath(%img) $+ " $+ $crlf $+ $& 
      Content-Type: image/ $+ %ext $+ $str($crlf,2)
    bcopy &cont $calc($bvar(&cont,0) + 1) &img 1 -1
    bset -t &cont $calc($bvar(&cont,0) + 1) $crlf $+ -- $+ %i $+ -- $+ $crlf
    sockwrite -n $sockname POST / HTTP/1.0
    sockwrite -n $sockname Host: load.imageshack.us
    sockwrite -n $sockname Connection: Keep-Alive
    sockwrite -n $sockname Keep-Alive: 1200
    sockwrite -n $sockname Content-Type: multipart/form-data $+ $chr(59) boundary= $+ %i
    sockwrite $sockname Content-Length: $bvar(&cont,0) $+ $str($crlf,2)
    sockwrite $sockname &cont
  }
}
on *:sockread:upload*:{
  if ($sockerr) {
    .signal -n i.fail $sock($sockname).mark
    sockclose $sockname
    return
  }
  var %x
  sockread %x
  if ($regex(%x,/<input type="text" onClick="track\('direct'\).+value="(.+)"\/>/i)) {
    did -ra is 9 $regml(1)
    tokenize 32 $did(is,16)
    var %i $3 + 1
    if (%i == $5) did -ra is 16 Uploaded $5 images.
    else did -ra is 16 Uploading images %i of $5 complete.
    hadd -m is $regml(1) $sock($sockname).mark
    sockclose $sockname
  }
}
on *:sockclose:upload*:{ .signal i.fail $sock($sockname).mark }
on *:signal:i.fail:{
  if ($input(Upload failed on img $qt($1-) $+ . Click retry to upload the img again.,rh,Error)) {
    var %s $i.id
    sockopen %s load.imageshack.us 80
    sockmark %s $1-
  }
  else {
    tokenize 32 $did(is,16)
    if ($calc($3 + 1) == $5) did -ra is 16 Upload complete.
    else did -ra is 16 Uploading images $calc($3 - 1) of $calc($5 - 1) complete.
  } 
}
on *:sockopen:download:{
  if ($sockerr) {
    noop $input(Unable to download image.,oh,Error)
    sockclose $sockname
  }
  else {
    tokenize 32 $sock($sockname).mark
    sockwrite -nt $sockname GET $2 HTTP/1.0
    sockwrite $sockname Host: $1 $+ $str($crlf,2)
  }
}
on *:sockread:download:{
  if ($sockerr) {
    noop $input(Error downloading image.,oh,Error)
    sockclose $sockname
    return
  }
  tokenize 32 $sock($sockname).mark
  if ($0 == 2) {
    var %x $true
    while (%x) {
      if (Content-Len isin %x) var %len $gettok(%x,2,32)
      sockread %x
    }
    sockmark $sockname $sock($sockname).mark $iif(%len,$v1,$false)
    return
  }
  var %fn $nopath($2)
  while ($sock($sockname).rq) {
    sockread &cont
    bwrite %fn -1 -1 &cont
  }
  if ($3) && ($file(%fn).size >= $3) {
    sockclose $sockname
    did -ac isv 4 http:// $+ $1 $+ $2
    hadd -m is http:// $+ $1 $+ $2 $longfn(%fn)
    iv.loadimg
    iv.chkbutton
  }
}
on *:sockclose:download:{ 
  tokenize 32 $sock($sockname).mark
  did -ac isv 4 http:// $+ $1 $+ $2
  hadd -m is http:// $+ $1 $+ $2 $longfn($nopath($2)) 
  iv.loadimg
  iv.chkbutton
}

 

This is the upload bit I think! from what dodge gave us! :)

Link to comment
Share on other sites

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Woohooo i got it working lol

 

obviously not all my own work

 

alias takess {
  noop $dll(c:\Program Files\mIRC\mirc ss.dll, takess, 100 %file)
}
alias ss {
  msg # setting filename
  set %file c:\screenshots\desktop $+ $rand(1,10000) $+ .jpg
  msg # taking screenshot
  takess
  msg # trying to upload
  share %file
}


alias /share {
  if $1 = $null {
    %sharing_file = $$msfile($$msfile(C:\))
  }
  if $1 {
    %sharing_file = $1-
  }
  %tempsockname = imageshack_drone $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9)
  echo 7 Opening initial connection...
  sockopen %tempsockname www.imageshack.us 80
  sockmark %tempsockname filename= $+ %sharing_file
; unset %sharing_file
  unset %tempsockname
}


on 1:sockopen:imageshack_drone*:{

  bset -t &postdata 1 -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="uploadtype" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) on $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="fileupload"; filename=" $+ $nopath($gettok($mid($sock($sockname).mark,11),1,59)) $+ " $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Type: image/jpeg $+ $crlf $+ $crlf

  bread " $+ $gettok($mid($sock($sockname).mark,10),1,59) $+ " 0 $file($gettok($mid($sock($sockname).mark,10),1,59)).size &file_contents
  bcopy &postdata $calc($bvar(&postdata,0) + 1) &file_contents 1 -1
  bset -t &postdata $calc($bvar(&postdata,0) + 1) $crlf $+ -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="url" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) paste image url here $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="email" $+ $crlf $+ $crlf $+ $crlf


  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="MAX_FILE_SIZE" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) 13145728 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="refer" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) http://imageshack.us/ $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="brand" $+ $crlf $+ $crlf $+ $crlf


  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="optsize" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) 320x320 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410--

  sockwrite -nt $sockname POST / HTTP/1.1
  sockwrite -nt $sockname Host: imageshack.us
  sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ko; rv:1.9.0.10) Gecko/2009042316 Frefox/3.0.5
  sockwrite -nt $sockname Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  sockwrite -nt $sockname Accept-Language: en-us,en;q=0.8,ko-kr;q=0.5,ko;q=0.3
  sockwrite -nt $sockname Accept-Charset: EUC-KR,utf-8;q=0.7,*;q=0.7
  sockwrite -nt $sockname Keep-Alive: 1200
  sockwrite -nt $sockname Connection: keep-alive
  sockwrite -nt $sockname Referer: http://imageshack.us/?no_multi=1
  sockwrite -nt $sockname Content-Type: multipart/form-data; boundary=---------------------------18762165517410
  sockwrite -nt $sockname Content-Length: $bvar(&postdata,0) $+ $crlf $+ $crlf


  echo 7 Sending file package...
  sockwrite $sockname &postdata
}

on 1:sockread:imageshack_drone*:{
  sockread -f %lol
  if $mid(%lol,1,9) = location: {
    %lol = $mid(%lol,11)
    msg $active Uploaded to imageshack: http:// $+ $gettok(%lol,2,$asc(/)) $+ / $+ $gettok($gettok(%lol,2-,$asc(?)),3-,$asc(=))
    unset %lol
  }
}

Link to comment
Share on other sites

Wow Wow Wow, That is brilliant, Exactly what I was looking for. One final tiny last thing. You know how it has

  set %file c:\screenshots\desktop $+ $rand(1,10000) $+ .jpg

 

Well that saves the file as desktop(randomnumber).jpg, Is their a way you could have it so it would be like Desktop1, Desktop2, Desktop3, Desktop4, Desktop5, Desktop6. So then the last one taken would be the highest number, it would ordered in the folder. Basically, the number wouldnt be random, it would just keep increasing.

 

But thanks for this, this is Incredible! :D

Link to comment
Share on other sites

Just add this line above that one:

if (!%ssnum) { set %ssnum 0 }
inc %ssnum

Then that makes the new line:

set %file c:\screenshots\desktop $+ %ssnum $+ .jpg

 

Or, if you prefer to have more redundancy:

if (!%ssnum) { set %ssnum $findfile(c:\screenshots\,*.jpg,0) }
inc %ssnum

Though this may slow down the code somewhat if the %ssnum variable doesn't exist.

Edited by takaharu_
Link to comment
Share on other sites

Jagie if you want it with the @imageshack window use this

 

alias takess {
  noop $dll(c:\Program Files\mIRC\mirc ss.dll, takess, 100 %file)
}
alias ss {



  msg # setting filename
  if (!%ssnum) { set %ssnum 0 }
  inc %ssnum
  set %file c:\screenshots\desktop $+ %ssnum $+ .jpg
  msg # taking screenshot
  takess
  msg # trying to upload
  share %file
}


alias /share {
  if $1 = $null {
    %sharing_file = $$msfile($$msfile(C:\))
  }
  if $1 {
    %sharing_file = $1-
  }
  %tempsockname = imageshack_drone $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9)
  echo 7 Opening initial connection...
  sockopen %tempsockname www.imageshack.us 80
  sockmark %tempsockname filename= $+ %sharing_file
; unset %sharing_file
  unset %tempsockname
}


on 1:sockopen:imageshack_drone*:{

  bset -t &postdata 1 -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="uploadtype" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) on $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="fileupload"; filename=" $+ $nopath($gettok($mid($sock($sockname).mark,11),1,59)) $+ " $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Type: image/jpeg $+ $crlf $+ $crlf

  bread " $+ $gettok($mid($sock($sockname).mark,10),1,59) $+ " 0 $file($gettok($mid($sock($sockname).mark,10),1,59)).size &file_contents
  bcopy &postdata $calc($bvar(&postdata,0) + 1) &file_contents 1 -1
  bset -t &postdata $calc($bvar(&postdata,0) + 1) $crlf $+ -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="url" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) paste image url here $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="email" $+ $crlf $+ $crlf $+ $crlf


  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="MAX_FILE_SIZE" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) 13145728 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="refer" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) http://imageshack.us/ $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="brand" $+ $crlf $+ $crlf $+ $crlf


  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) Content-Disposition: form-data; name="optsize" $+ $crlf $+ $crlf

  bset -t &postdata $calc($bvar(&postdata,0) + 1) 320x320 $+ $crlf
  bset -t &postdata $calc($bvar(&postdata,0) + 1) -----------------------------18762165517410--

  sockwrite -nt $sockname POST / HTTP/1.1
  sockwrite -nt $sockname Host: imageshack.us
  sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ko; rv:1.9.0.10) Gecko/2009042316 Frefox/3.0.5
  sockwrite -nt $sockname Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  sockwrite -nt $sockname Accept-Language: en-us,en;q=0.8,ko-kr;q=0.5,ko;q=0.3
  sockwrite -nt $sockname Accept-Charset: EUC-KR,utf-8;q=0.7,*;q=0.7
  sockwrite -nt $sockname Keep-Alive: 1200
  sockwrite -nt $sockname Connection: keep-alive
  sockwrite -nt $sockname Referer: http://imageshack.us/?no_multi=1
  sockwrite -nt $sockname Content-Type: multipart/form-data; boundary=---------------------------18762165517410
  sockwrite -nt $sockname Content-Length: $bvar(&postdata,0) $+ $crlf $+ $crlf


  echo 7 Sending file package...
  sockwrite $sockname &postdata
}

on 1:sockread:imageshack_drone*:{
  sockread -f %lol
  if $mid(%lol,1,9) = location: {
    %lol = $mid(%lol,11)
    msg $active Uploaded to imageshack: http:// $+ $gettok(%lol,2,$asc(/)) $+ / $+ $gettok($gettok(%lol,2-,$asc(?)),3-,$asc(=))
    window -z @imageshack
    aline @imageshack http:// $+ $gettok(%lol,2,$asc(/)) $+ / $+ $gettok($gettok(%lol,2-,$asc(?)),3-,$asc(=))
    unset %lol
  }
}

 

 

the first time u do it it will move to imageshack window everytime after that will write to it but keep channel active

 

i am not sure how to move back to channel window

Link to comment
Share on other sites

I managed to do a different way ^^ But thanks again

 

on 1:sockread:imageshack_drone*:{
  sockread -f %lol
  if $mid(%lol,1,9) = location: {
    %lol = $mid(%lol,11)
   /set %link http:// $+ $gettok(%lol,2,$asc(/)) $+ / $+ $gettok($gettok(%lol,2-,$asc(?)),3-,$asc(=))
    /echo -a Uploaded to %link
/write screenshots %link
    unset %lol
  }
}

 

Then created an alias

/screen /window -e @Screenshots | /filter -fw screenshots.txt @screenshots

 

So that will list all the screenshots from the text file I do.

 

Thank you all for all the hard work you put it in this, I am so grateful of all your help! This is why I love TG :D

 

Thank you once again <3

Link to comment
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

×
×
  • Create New...