mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
I am running a while loop, to go through a list and download text from each link using a socket, into a specific file name. Only problem is, it downloads it all at once, so if there is 3 different files to download, test1 test2 and test3, it only downloads test3 because the other two tests don't get time to download there text from there links in time before while loop ends and begins next loop. when it pauses though, I need the sockets to carry on going, which are in a seperate alias laugh I just need the loop to stop.

Last edited by dominic_eddy; 13/04/14 02:38 PM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
How about you sleep the script before going through the loop once again with this script Loki posted a while ago.

Code:
alias sleep {
  if ($1 !isnum 1-) return
  var %a = $ticks $+ .vbs
  write %a wscript.sleep $1
  .comopen %a wscript.shell
  if (!$comerr) .comclose %a $com(%a,Run,3,bstr,%a,uint,0,bool,true) 
  .remove %a
}


Quote:
You may be able to structure your code to sleep instead of using a timer: /sleep 60000 will pause the script at that line for 60 seconds

Source


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
I'll give it a try, thanks nillen and loki! smile

Last edited by dominic_eddy; 13/04/14 03:02 PM.
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
Doesn't seem to work, its still going through it very quickly D: I'm putting /sleep 5000

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Do you have com locked? Check options > other > lock

What you're describing doesn't really make sense though, can you provide the code? You can open a socket in loop, but no action will be taken on it until the loop is done.

Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
I went to options, and everything is unticked smile

And I'm calling an alias which does the socket stuff. You know a little while ago you helped me with sockets for pastie.org?
https://forums.mirc.com/ubbthreads.php/topics/244604/Using_sockets_to_insert_text#Post244604

Well, I'm basically using that code you created to call it multiple times in a while loop. It's seeing how many files it needs to download, then uses the whileloop to count up and call the pastie.get command laugh

Code:
set %FILES 1 
  while ($readini(scriptdetails.ini,n,$1,file $+ %FILES) != $null) {
    set -u10 %output $gettok($readini(scriptdetails.ini,n,$1,file $+ %FILES),1,32)
    pastie.get $gettok($readini(scriptdetails.ini,n,$1,file $+ %FILES),2,32)
    echo 3 -ag External INI file %output downloaded.
    /sleep 5000
    inc %INIFILES 1

Last edited by dominic_eddy; 13/04/14 03:57 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
There's no problem calling pastie.get multiple times

Code:
alias pastie.test {
  pastie.get http://pastie.org/pastes/9077474
  pastie.get http://pastie.org/pastes/9077475
  pastie.get http://pastie.org/pastes/9077479
}


The problem is you're using the same global %output variable instead of passing the output to pastie.get when you call it. You can specify a file or folder for output.

/pastie.get url output

Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
Last time i tried that i didn't work, but il try again! laugh

Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
I haven't done it very efficiently, but it will do for now, thanks guys smile


Link Copied to Clipboard