Gummo commented on a Page, Nicklist.dll alias  -  Aug 06, 2010

Use a variable. $findfile is extremely inefficient when you know the location already.

alias nicklist {
  var %path path/to/Nicklist.dll
  if ($1 == -al) { noop $dll(%path,ListBox,$window($2).hwnd Aline $calc($3 - 1)) | return }
  if ($1 == -rl) { noop $dll(%path,ListBox,$window($2).hwnd Dline $calc($3 - 1)) | return }
  if ($1 == -il) { noop $dll(%path,ListBox,$window($2).hwnd Iline $calc($3 - 1) $4) | return }
  if ($1 == -cl) { noop $dll(%path,ListBox,$window($2).hwnd Cline $calc($3 - 1) $4) | return }
  if ($1 == -dc) { noop $dll(%path,ListBox,$window($2).hwnd DColor $3) | return }
  if ($1 == -rs) { noop $dll(%path,ListBox,$window($2).hwnd $3 $4) | return }
  if ($1 == -s) { noop $dll(%path,ListBox,$window($2).hwnd $3 $iif($4,$4,)) | return }
  if ($1 == -ti) { 
    if (!$3) { return $dll(%path,$window($2).hwnd TopIndex) }
    else { noop $dll(%path,ListBox,$window($2).hwnd TopIndex $3) }
  }
}

It can be simplified more anyway if you set %arguments and then just execute that as in:

alias nicklist {
  var %args
  if ($1 == -al) %args = Aline $calc($3 - 1)
  if ($1 == -rl) %args = Dline $calc($3 - 1)
  if ($1 == -il) %args = Iline $calc($3 - 1) $4
  if ($1 == -cl) %args = Cline $calc($3 - 1) $4
  if ($1 == -dc) %args = DColor $3
  if ($1 == -rs) %args = $3 $4
  if ($1 == -s) %args = $3 $iif($4,$4,)
  if ($1 == -ti) { 
    if (!$3) %args = TopIndex
    else %args = TopIndex $3
  }
  if (%args) noop $dll(path/to/DLL,ListBox,$window($2).hwnd %args)
}

By the way, I don't get $iif($4,$4,).. The only thing that would do is replace 0 and $false with $null.

 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.