/loadfile

By zonirc on May 02, 2006


This snippet been made when Ive got some problem whenever try to loading other addon/snippet. Since ive got a small memory(not computer memory but my mind :P) so its really cause me some problem to remembering all the snippet/addon Ive had.

So i hope you guys will love to use it :P

Oh yeah put this thing into your remote section :P

;Name: /mwin
;Author: zonirc
;Email: zonirc@email.com
;mIRC version: 6.15 and above

;ENGLISH
;--------------------

;Install:
;type '/load -rs <this file address>' where <this file address> is the location where you save
;this file. Type it in your mirc and when asked for authorization, click on any button to
;continue, it does not have any effect on this file (no on load event) 

;/loadfile -rs|a <filename>
;checked the specified file not containing the existed alias before loaded it.

;-rs|a:
;-rs = for use when the specified file will be loaded as a remote file.
;-a = for use when the specified file will be loaded as an aliases file.

;<filename>:
;- the filename that want to be loaded into your mIRC which it must be in a fullname and
;there are no need to quote it.

;Example:
;/loadfile -rs c:\mirc\myremote.mrc
;/loadfile -a c:\mirc\myalias.ini
;//loadfile -rs $mircdirmyremote.ini

;Credits:
;- bruas@biase
;- da^hype
;- h3lp@ArePie
;- marlboro21

;BAHASA MALAYSIA
;----------------------------------------------

;Install:
;Taip '/load -rs <fail nie punya lokasi>' dimana <fail nie punya lokasi>
;merupakan lokasi fail nie di save oleh anda. Taip ia di mIRC anda dan
;kemudian bila mirc memintak 'authorization', klik saja memana butang
;yg terdapat pada message dialog tu.

;/loadfile -rs|a <namafail>
;memeriksa fail yang dinyatakan mengandungi alias yang telah pun wujud di dalam mIRC anda
;sebelum 'load' fail terbabit.

;-rs|a:
;-rs = dinyatakan apabila fail yang dinyatakan ingin di load sebagai remote.
;-a = dinyatakan apabila fail yang dinyatakan ingin di load sebagai alias.

;<namafail>:
;- fail yang ingin di load, di mana ianya perlulah dinyatakan sebagai nama penuh fail
;terbabit iaitu mempunyai direktorinya sekali. Ianya tidak perlu di quotekan.

;Contoh:
;/loadfile -rs c:\mirc\myremote.mrc
;/loadfile -a c:\mirc\myalias.ini
;//loadfile -rs $mircdirmyremote.ini

;Penghargaan:
;- bruas@biase
;- da^hype
;- h3lp@ArePie
;- marlboro21 

alias loadfile {
  var %e = echo -ftsac Info * /loadfile:
  if ($isid) $replace(%e,/,$) Unknown Identifier
  elseif (!$istok(-rs -a,$1,32)) %e $iif($1,Invalid,Insufficient) Parameter
  elseif (!$isfile($2-)) %e $iif($2,No Such File - $2- ,Missing Parameter)
  else {
    filter -fkn $+(",$2-,") lf $+(*,$replacex($1,-a,/,-rs,alias),*)
    if ($window(@loadfile)) {
      iline  $color(info) @loadfile 1 [Existed Alias Found:]
      %e Cannot loaded $2- because theres a duplicated aliases on it.
      window -aw @loadfile
    }
    else load $1 $+(",$2-,")
  }
}

alias -l lf {
  tokenize 32 $1
  var %t, %x = $regsub($2-,/^n\d+=/i,,%t), %a
  if (alias * iswm %t) {
    if ($gettok(%t,2,32) != -l) %a = $v1
  }
  elseif (/* iswm %t) %a = $gettok($mid(%t,2),1,32)
  if ($isalias(%a).fname) {
    var %f = $v1
    if (!$window(@loadfile)) window -h @loadfile
    echo -c info @loadfile %a $+((Line: $1 File: %f $+ ))
  }
}

Comments

Sign in to comment.
zonirc   -  May 06, 2006

KuTsuM... well I think youre are right.. i have rethinking about it and actually ive use tokenizing to make my coding more easiest so that later on I didnt need to use $gettok but can refer the param as $1, $2, etc... but in this code its not usefull anyway. However, I think youre are wrong about $1 will be refering as \"my\" since when you using /filter -k it will matching the whole line and $1 will be refer to it therefore if you using $2 or else it simply will not return anything. Also, im using the -n switches which means each matching line will be return with the line numbers which is on this format:

therefore when i want to refer it as on this thing: (Line: $1 File: %f $+ )) but like what i said at the start that it is not usefull... thanx anyway KuTsuM... well im will look into this code more after this to recoding it.
 Respond  
KuTsuM   -  May 03, 2006

$1 on that string is \"my\", besides I don\'t see how it\'s usefull. It takes a lot of system resources to split strings up, and if you just want to return the entire string, use $1-, rather than splitting the string up once again

 Respond  
zonirc   -  May 03, 2006

well the purpose is to check the specified file not containing any existed alias since if its already existed then only the 1st found alias will be triggered by mirc so its will make the specified file cant work correctly :) and for the tokenizing $1 actualy when you use /filter into custom alias you will receive all the result on $1. For example when the result is \"my nickname is zonIRC\" so when you refer it as $1 it will return all of the words but if you refer it as $2 you will not get anything since only $1 is supported.

 Respond  
spitfire3292   -  May 02, 2006

whats it do exactly? lol..is it just an easier way to load things?

 Respond  
KuTsuM   -  May 02, 2006

How is tokenizing $1 by ASCII 32 usefull in anyway?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.