mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2006
Posts: 23
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Oct 2006
Posts: 23
I want to make a script that takes all lines starting with 'a' and put it in 'a.txt' the same goes for 'b' and 'b.txt' and so on.


Code:

on *:TEXT:*:#: { 

  if ($strip($1) == !filmtips ) {
    msg $chan 3http://www.com
  } 

  if ($strip($$1) == !addfilmtips) { 

    if (http://imdb.com/* iswm $2) || (http://www.imdb.com/* iswm $2) || ($2 == URL ) {

      if ( a* iswm $3 ) {

        write C:\PATH\a.txt <a title=" $+ $3- $+ " href=" $+ $2 $+ " target="_blank"> $+ $3- $+ </a><br />
        filter -ffcut 1 32 C:\PATH\a.txt C:\PATH\a.txt
        msg $chan 3done
      }

      if ( b* iswm $3 ) {

        write C:\PATH\b.txt <a title=" $+ $3- $+ " href=" $+ $2 $+ " target="_blank"> $+ $3- $+ </a><br />
        filter -ffcut 1 32 C:\PATH\b.txt C:\PATH\b.txt
        msg $chan 3done
      }

	;#####################################################
	;# here follows a "manual loop" where I have repeted # 
	;# the above for each letter in the alphabet         #
	;# (dont know how to do it in a smoother way)        #
	;#####################################################

      else {

        write C:\PATH\#.txt <a title=" $+ $3- $+ " href=" $+ $2 $+ " target="_blank"> $+ $3- $+ </a><br />
        filter -ffcut 1 32 C:\PATH\#.txt C:\PATH\#.txt
        msg $chan 3done
      }

    }

    else {
      msg $chan 3the string must start with 'http://imdb.com/' or 'URL'
    }

  }

}



the letters are beeing sorted as they should but then when I added the else part to take care of all numbers and exlamation marks and similar, the script starts to add every line to both the right .txt and #.txt


so the helping part would be how to add each letter to a different files.


Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
How about..
Code:
on *:TEXT:!*filmtips*:#: { 
  if ($strip($1) == !filmtips ) { msg $chan 3http://www.com } 
  elseif ($strip($$1) == !addfilmtips) { 
    if (http://imdb.com/* iswm $2) || (http://www.imdb.com/* iswm $2) || ($2 == URL ) {
      if ($left($3,1) isalpha) {
        var %a = $+("C:\PATH\,$v1,.txt")
        else var %a = $qt(C:\PATH\#.txt)
        write %a $+(<a title=",$3-," href=",$2," target="_blank">,$3-,</a>
)
        filter -ffcut 1 32 %a %a
        msg $chan 3done
      }
    }
    else { msg $chan 3the string must start with 'http://imdb.com/' or 'URL' }
  }
}

Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Flawed code above, sorry.

Code:
on *:TEXT:!*filmtips*:#: { 
  if ($strip($1) == !filmtips) { msg $chan 3http://www.com } 
  elseif ($strip($1) == !addfilmtips) { 
    if (http://imdb.com/* iswm $2) || (http://www.imdb.com/* iswm $2) || ($2 == URL ) {

      if ($left($$3,1) isalpha) { var %a = $+("C:\PATH\,$v1,.txt") }
      else { var %a = $qt(C:\PATH\#.txt) }

      write %a $+(<a title=",$3-," href=",$2," target="_blank">,$3-,</a>)
      filter -ffcut 1 32 %a %a
      msg $chan 3done
    }
    else { msg $chan 3the string must start with 'http://imdb.com/' or 'URL' }
  }
}


Joined: Oct 2006
Posts: 23
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Oct 2006
Posts: 23
thanks smile


Link Copied to Clipboard