iTunes Player — File Browser

iTunesPlayerv4.0 / iTunesPlayerv4.0 / iTunes / itunes.mrc

itunes.mrc — 43.92 KB — Download this file

; BETA version
; made by me [ brando ]
; Contact me at brandoaway@gmail.com for suggestions, comments, help ect..
; made on version 6.34 and tested on version 6.31
; dcx can be found at: http://dcx.scriptsdb.org/archive.htm
; this script can be redownloaded at: http://rapidshare.com/files/150972806/itunes.zip.html
; NOTE: if your mIRC is crashing, its probably because you already have dcx commands loaded somewhere else.
;   To avoid this, scroll down near the last line and find ;DCX commands and remove them (3).

dialog itunes {
  title "iTunes Player v4.0"
  size -1 -1 262 $iif($hget(iset,vol),58,83)
  option pixels
}
on *:dialog:itunes:*:*:{
  if ($devent == init) {
    dcx Mark $dname itunes.cb
    xdialog -b $dname $iif($hget(iset,min),+nty,+ty)
    xdialog -c $dname 1 toolbar -3 -3 528 34 flat top list tabstop $iif($hget(iset,tooltips),tooltips) nodivider $iif($hget(iset,tcol),notheme)
    xdid -l $dname 1 16
    xdid -m $dname 1 1
    var %c = $iif($hget(iset,tcol),$v1,0)
    xdid -a $dname 1 0 +c 0 0 %c 9 $chr(9) BackTrack
    xdid -a $dname 1 0 +c 0 0 %c 4 $chr(9) Play
    xdid -a $dname 1 0 +c 0 0 %c < $chr(9) Stop
    xdid -a $dname 1 0 +c 0 0 %c : $chr(9) NextTrack
    xdid -a $dname 1 0 + 0 0 0 -
    xdid -a $dname 1 0 + 0 4 0 $chr(9) $iif($hget(iset,say),Amsg,Say to active)
    xdid -a $dname 1 0 + 0 1 0 $chr(9) Settings
    xdid -a $dname 1 0 $iif($hget(iset,startup),+kx,+k) 0 2 0 $chr(9) Show
    xdid -w $dname 1 +ahdn $hget(iset,seticon)
    xdid -w $dname 1 +ahdn $hget(iset,sicon)
    xdid -w $dname 1 +ahdn $hget(iset,hicon)
    xdid -w $dname 1 +ahdn $hget(iset,sayicon)
    xdid -f $dname 1 +a default 11 webdings
    xdid -m $dname 1 0

    xdialog -c $dname 2 pbar 4 33 250 20 $iif($hget(iset,pbar) == 2,notheme,$iif($v1 == 3,notheme smooth,$iif($v1 == 4,gradient)))
    xdid -c $dname 2 $hget(iset,pcol1)
    xdid -q $dname 2 $hget(iset,ptext)
    xdid -C $dname 2 +g $hget(iset,pcol1)
    xdid -C $dname 2 +G $hget(iset,pcol2)
    xdid -r $dname 2 0 100

    xdialog -c $dname 3 listview 5 85 250 118 report fullrow singlesel nolabelwrap tooltip tabstop grid noheader $iif(!$hget(iset,sort),noheadersort)
    xdid -t $dname 3 + 0 70 Item	+ 0 176 Info
    xdid -w $dname 3 +ahdn $hget(iset,ticon)
    xdid -w $dname 3 +ahdn $hget(iset,ricon)

    xdialog -c $dname 4 image 4 59 20 20 
    xdid -i $dname 4 +b $hget(iset,mutepic)

    xdialog -c $dname 5 image 234 59 20 20
    xdid -i $dname 5 +b $hget(iset,volpic)

    xdialog -c $dname 6 pbar 24 59 210 20 $iif($hget(iset,vbar) == 2,notheme,$iif($v1 == 3,notheme smooth,$iif($v1 == 4,gradient)))
    xdid -c $dname 6 $hget(iset,vcol1)
    xdid -q $dname 6 $hget(iset,vtext)
    xdid -C $dname 6 +g $hget(iset,vcol1)
    xdid -C $dname 6 +G $hget(iset,vcol2)

    xdialog -w $dname + $hget(iset,dicon)
    xdid -f itunes 2,3,6 $hget(iset,font)
    if ($hget(iset,bg)) { xdialog -g $dname +b $v1 }
    .comopen m itunes.application
    if ($comerr) {
      dialog -x $dname
      noop $input(You do not have itunes installed on this computer.,oh,Error)
    }
    else {
      noop $com(m,PlayerState,2)
      if (!$com(m).result) { noop $com(m,PlayPause,1) $com(m,PlayPause,1) }
      if ($hget(iset,startup)) {
        xdialog -S $dname -1 -1 261 209
        xdid -i $dname 1 8 3
        xdid -q $dname 1 8 Hide
      }
      xdid -M $dname 1 $iif($hget(iset,startup),$true,$false)
      dialog -t $dname $i.titlebar($iif($xdid(itunes,1).mark,s,h))
      .timerTunes 0 1 dialog -t $dname $!i.titlebar($iif($xdid(itunes,1).mark,s,h))
    }
  }
  elseif ($devent == close) {
    .timerTunes off
    closecom m x y i
  }
}
alias itunes.cb {
  var %dname = $1,%devent = $2,%did = $3
  if (%devent == sclick) {
    if (%did == 1) {
      if ($4 == 1) {
        noop $com(m,BackTrack,1)
        xdid -v %dname 2 0
      }
      elseif ($4 == 2) {
        noop $com(m,PlayPause,1)
        xdid -v %dname %did 2 $iif($xdid(%dname,%did,2).text == ;,4,;)
        xdid -q %dname %did 2 $iif($xdid(%dname,%did,2).text == ;,Pause,Play)
      }
      elseif ($4 == 3) {
        noop $com(m,Stop,1)
        xdid -v %dname 2 0
        xdid -r %dname 3
        xdid -i %dname 2 00:00 / 00:00
        xdid -v %dname %did 2 4
        xdid -q %dname %did 2 Play
      }
      elseif ($4 == 4) {
        noop $com(m,NextTrack,1)
        xdid -v %dname 2 0
      }
      elseif ($4 == 6) { 
        tokenize 149 $getinfo(Artist,Track,Album,Pos,Time,Count,Rate)
        var %m = 05[ 07iTunes Player 05] Artist:07 $1 05Track:07 $2 05Album:07 $3 05Current Position:07 $remtok($duration($4,3),00,1,58) 05Duration:07 $5 05Play Count:07 $6 05My Rating:07 $calc($7 /20) $+ /5
        if ($hget(iset,say)) { 
          var %u = $chan(0)
          while (%u) {
            if (!$istok(#msl #irchelp #help #cwc,$chan(%u),32)) { msg $chan(%u) %m }
            dec %u
          }
        }
        else { $iif($regex($active,/^(?:@\S|Status Window$)/),echo -a,msg $active) %m }
      }
      elseif ($4 == 7) { dialog $iif($dialog(iset),-v,-m) iset iset }
      elseif ($4 == 8) {
        var %e = $xdid(%dname,1).mark
        xdialog -S %dname -1 -1 261 $iif(%e,$iif($hget(iset,vol),58,83),209)
        xdid -i %dname 1 8 $iif(%e,2,3)
        xdid -q %dname 1 8 $iif(%e,Show,Hide)
        dialog -t %dname $i.titlebar($iif(%e,h,s))
        xdid -M %dname 1 $iif(%e,$false,$true)
      }
    }
    elseif (%did == 4) { 
      xdid -v %dname 6 0
      noop $com(m,SoundVolume,4,int,0)
    }
    elseif (%did == 5) {
      xdid -v %dname 6 100
      noop $com(m,SoundVolume,4,int,100)
    }
  }
  elseif ($regex(%devent %did,/^(?:mousebar \d|sclick [67])$/i)) {
    if (%did == 2) && (!$hget(iset,posedit)) { return }
    if (%did == 6) && (!$hget(iset,volcontrol)) { return }
    if (%did != 3) { xdid -v %dname %did $4 }
    if (%did == 2) { .comclose i $com(m,CurrentTrack,3,dispatch* i) $com(i,Time,2) $com(m,PlayerPosition,4,int,$int($calc($duration($com(i).result) * ($xdid(itunes,2).value / 100)))) }
    elseif (%did == 3) {
      var %e = $iif(!$4,0,$iif($4 < 21,20,$iif($4 < 41,40,$iif($4 < 61,60,$iif($4 < 81,80,100)))))
      xdid -v %dname %did 6 2 -v %e
      xdid -v %dname %did 6 2 -i $calc(%e / 20) Stars
      .comclose i $com(m,CurrentTrack,3,dispatch* i) $com(i,Rating,4,int,%e)
    }
    elseif (%did == 6) { noop $com(m,SoundVolume,4,int,$4) }
  }
}
dialog iset {
  title "iTunes Player Settings - /i.set"
  size -1 -1 498 335
  option pixels
}
on *:dialog:iset:*:*:{ 
  if ($devent == init) {
    dcx Mark $dname iset.cb
    xdialog -b $dname +hty
    xdialog -c $dname 1 treeview 4 4 116 282 haslines showsel tabstop hasbuttons linesatroot notooltips nohscroll
    xdid -l $dname 1 16
    xdid -a $dname 1 1	+ 0 0 0 0 0 0 0 Options
    xdid -a $dname 1 1 1	+ 0 0 0 0 0 0 0 StartUp
    xdid -a $dname 1 1 2	+ 0 0 0 0 0 0 0 Customize
    xdid -a $dname 1 2	+ 0 0 0 0 0 0 0 Appearance
    xdid -a $dname 1 2 1	+ 0 0 0 0 0 0 0 Icons
    xdid -a $dname 1 2 2	+ 0 0 0 0 0 0 0 Background
    xdid -a $dname 1 2 3	+ 0 0 0 0 0 0 0 Track buttons
    xdid -a $dname 1 2 4	+ 0 0 0 0 0 0 0 Player position
    xdid -a $dname 1 2 5	+ 0 0 0 0 0 0 0 Font
    xdid -a $dname 1 2 6	+ 0 0 0 0 0 0 0 Rating bar
    xdid -a $dname 1 2 7	+ 0 0 0 0 0 0 0 Volume bar

    xdialog -c $dname 6 box 129 109 360 180 rounded
    xdid -t $dname 6 Titlebar
    xdid -c $dname 6 7 text 17 18 180 16
    xdid -t $dname 7 Editing titlebar text when info list is:
    xdid -c $dname 6 8 comboex 188 14 60 80 dropdown
    xdid -a $dname 8 1 0 0 0 0 Shown
    xdid -a $dname 8 1 0 0 0 0 Hidden
    xdid -c $dname 8 1
    xdid -c $dname 6 9 text 17 42 30 15
    xdid -t $dname 9 Text:
    xdid -c $dname 6 10 edit 80 39 270 21 autohs
    xdid -a $dname 10 $hget(iset,titlebar.h)
    xdid -c $dname 6 11 text 17 66 50 15
    xdid -t $dname 11 Identifiers:
    xdid -c $dname 6 12 listview 80 63 270 106 report fullrow singlesel tooltip
    xdid -t $dname 12 + 0 80 Identifier	+ 0 169 Description
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <version> $chr(9) + 0 0 0 0 Script version
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <mversion> $chr(9) + 0 0 0 0 mIRC version
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <track> $chr(9) + 0 0 0 0 Currently playing track name
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <artist> $chr(9) + 0 0 0 0 Currently playing artist
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <album> $chr(9) + 0 0 0 0 Currently playing album
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <time> $chr(9) + 0 0 0 0 Currently playing track duration (length)
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <ctime> $chr(9) + 0 0 0 0 Current time position in track
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <count> $chr(9) + 0 0 0 0 Current track play count
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <rate> $chr(9) + 0 0 0 0 Current track rating
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <vol> $chr(9) + 0 0 0 0 Volume value
    xdid -a $dname 12 0 0 + 0 0 0 0 0 0 <author> $chr(9) + 0 0 0 0 Script author

    xdialog -c $dname 14 box 129 60 360 45 rounded
    xdid -t $dname 14 General
    xdid -c $dname 14 17 text 17 18 58 16
    xdid -t $dname 17 On startup:
    xdid -c $dname 14 18 comboex 77 14 53 80 dropdown 
    xdid -a $dname 18 0 0 0 0 0 Hide
    xdid -a $dname 18 0 0 0 0 0 Show
    xdid -c $dname 18 $iif($hget(iset,startup),2,1)
    xdid -c $dname 14 19 text 137 18 100 16
    xdid -t $dname 19 Info list

    xdialog -c $dname 15 text 128 10 250 40
    xdid -t $dname 15 Select a Category
    xdid -f $dname 15 + ansi 20 Tahoma

    xdialog -c $dname 16 line 129 45 360 15

    ; Unfinished feature: customize event for vol icon click
    ;xdid -c $dname 20 25 text 17 48 25 16
    ;xdid -t $dname 25 Icon:
    ;xdid -c $dname 20 26 comboex 60 45 90 80 dropdown
    ;xdid -a $dname 26 0 0 1 1 0 Mute
    ;xdid -a $dname 26 0 0 2 2 0 Volume
    ;xdid -c $dname 26 2
    ;xdid -w $dname 26 +hdna 109 shell32.dll
    ;xdid -w $dname 26 +hdna 168 shell32.dll
    ;xdid -c $dname 20 27 text 17 75 35 16 
    ;xdid -t $dname 27 Event:
    ;xdid -c $dname 20 28 comboex 60 72 90 80 dropdown
    ;xdid -a $dname 28 0 0 0 0 0 Do nothing
    ;xdid -a $dname 28 0 0 0 0 0 Set volume
    ;xdid -c $dname 28 $iif(Set * iswm $hget(iset,vevent),2,1)
    ;xdid -c $dname 28 2
    ;xdid -c $dname 20 29 text 158 75 20 16
    ;xdid -t $dname 29 To:
    ;xdid -c $dname 20 30 edit 180 73 40 20 number
    ;xdid -q $dname 30 3
    ;xdid -a $dname 30 $gettok($hget(iset,vevent),3,32)
    ;if (Do nothing * iswm $hget(iset,vevent)) { xdid -h $dname 30 }

    xdialog -c $dname 31 box 129 60 360 200 rounded
    xdid -t $dname 31 Miscellaneous
    xdid -c $dname 31 33 check 17 20 180 16
    xdid -t $dname 33 Enable tooltips
    if ($hget(iset,tooltips)) { xdid -c $dname 33 }
    xdid -c $dname 31 35 check 17 42 180 16
    xdid -t $dname 35 Enable player position editing
    if ($hget(iset,posedit)) { xdid -c $dname 35 }
    xdid -c $dname 31 999 check 17 64 180 16
    xdid -t $dname 999 Keep player always on top
    if ($hget(iset,top)) { xdid -c $dname 999 }
    xdid -c $dname 31 20 check 17 86 180 16
    xdid -t $dname 20 Enable volume control
    if ($hget(iset,volcontrol)) { xdid -c $dname 20 }
    xdid -c $dname 31 39 check 17 108 180 16
    xdid -t $dname 39 Open dialog to desktop
    if ($hget(iset,desk)) { xdid -c $dname 39 }
    xdid -c $dname 31 40 check 17 130 180 16
    xdid -t $dname 40 Minimize/restore buttons
    if ($hget(iset,min)) { xdid -c $dname 40 }
    xdid -c $dname 31 47 check 17 152 180 16
    xdid -t $dname 47 Hide volume bar with track info list
    if ($hget(iset,vol)) { xdid -c $dname 47 }
    xdid -c $dname 31 21 check 17 174 180 16
    xdid -t $dname 21 Say to all channels
    if ($hget(iset,say)) { xdid -c $dname 21 }

    xdialog -c $dname 36 box 129 60 360 174 rounded
    xdid -t $dname 36 Icons
    xdid -c $dname 36 37 listview 17 20 180 140 icon showsel singlesel
    xdid -a $dname 37 0 0 + 1 0 0 0 0 0 Dialog icon
    xdid -a $dname 37 0 0 + 2 0 0 0 0 0 Settings icon
    xdid -a $dname 37 0 0 + 3 0 0 0 0 0 Hide icon
    xdid -a $dname 37 0 0 + 4 0 0 0 0 0 Show icon
    xdid -a $dname 37 0 0 + 5 0 0 0 0 0 Track icon
    xdid -a $dname 37 0 0 + 6 0 0 0 0 0 Rating icon
    xdid -w $dname 37 +hdna $hget(iset,dicon)
    xdid -w $dname 37 +hdna $hget(iset,seticon)
    xdid -w $dname 37 +hdna $hget(iset,hicon)
    xdid -w $dname 37 +hdna $hget(iset,sicon)
    xdid -w $dname 37 +hdna $hget(iset,ticon)
    xdid -w $dname 37 +hdna $hget(iset,ricon)
    ;xdid -i $dname 37 +bk $rgb(209,215,226)
    xdid -M $dname 37 6
    xdid -c $dname 36 38 button 220 20 80 25 notheme vgradient
    xdid -t $dname 38 Change icon
    xdid -h $dname 38

    xdialog -c $dname 55 box 129 60 360 65 rounded
    xdid -t $dname 55 Background
    xdid -c $dname 55 56 text 17 30 100 16
    xdid -t $dname 56 Background color:
    xdid -c $dname 55 88 text 130 30 50 16 center
    xdid -t $dname 88 No fill
    xdid -f $dname 88 +b ansi 9 arial
    xdid -c $dname 55 57 text 130 22 50 30
    if ($hget(iset,bg)) {
      xdid -h $dname 88
      xdid -C $dname 57 +b $hget(iset,bg)
    }
    else { xdid -h $dname 57 }
    xdid -c $dname 55 58 button 200 25 60 25 notheme vgradient
    xdid -t $dname 58 Change
    xdid -c $dname 55 59 button 270 25 60 25 notheme vgradient
    xdid -t $dname 59 No fill

    xdialog -c $dname 62 box 129 60 360 65 rounded
    xdid -t $dname 62 Track buttons
    xdid -c $dname 62 63 text 17 30 100 16
    xdid -t $dname 63 Button colors:
    xdid -c $dname 62 64 text 130 22 50 30
    xdid -C $dname 64 +b $hget(iset,tcol)
    xdid -c $dname 62 65 button 200 25 60 25 notheme vgradient
    xdid -t $dname 65 Change

    xdialog -c $dname 66 box 129 60 360 190 rounded
    xdid -t $dname 66 Player Position
    xdid -c $dname 66 67 text 17 30 50 16
    xdid -t $dname 67 Style:
    xdid -c $dname 66 68 comboex 80 27 160 100 dropdown
    xdid -a $dname 68 0 0 0 0 0 OS Theme
    xdid -a $dname 68 0 0 0 0 0 Normal 
    xdid -a $dname 68 0 0 0 0 0 Smooth 
    xdid -a $dname 68 0 0 0 0 0 Gradient
    xdid -c $dname 68 $hget(iset,pbar)
    xdid -c $dname 66 69 text 17 60 50 16
    xdid -t $dname 69 Preview:
    xdid -c $dname 66 70 pbar 80 58 160 20
    xdid -c $dname 66 71 pbar 80 58 160 20 notheme
    xdid -c $dname 66 72 pbar 80 58 160 20 notheme smooth
    xdid -c $dname 66 73 pbar 80 58 160 20 gradient
    xdid -q $dname 70,71,72,73 $hget(iset,ptext)
    xdid -c $dname 71,72 $hget(iset,pcol1)
    xdid -C $dname 73 +g $hget(iset,pcol1)
    xdid -C $dname 73 +G $hget(iset,pcol2)
    xdid -v $dname 70,71,72,73 50
    xdid -i $dname 70,71,72,73 01:50 / 03:00
    xdid -f $dname 70,71,72,73 + ansi 10 Trebuchet MS
    xdid -c $dname 66 41 text 17 90 50 16 
    xdid -t $dname 41 Color 1:
    xdid -c $dname 66 42 text 80 83 50 30
    xdid -C $dname 42 +b $hget(iset,pcol1)
    xdid -c $dname 66 43 button 140 85 60 25 notheme vgradient
    xdid -t $dname 43 Change
    xdid -c $dname 66 44 text 17 120 50 16
    xdid -t $dname 44 Color 2:
    xdid -c $dname 66 45 text 80 113 50 30
    xdid -C $dname 45 +b $hget(iset,pcol2)
    xdid -c $dname 66 46 button 140 115 60 25 notheme vgradient
    xdid -t $dname 46 Change
    xdid -c $dname 66 48 text 17 155 50 16
    xdid -t $dname 48 Text color:
    xdid -c $dname 66 49 text 80 150 50 25
    xdid -C $dname 49 +b $hget(iset,ptext)
    xdid -c $dname 66 50 button 140 150 60 25 notheme vgradient
    xdid -t $dname 50 Change
    iset.cb $dname sclick 68

    xdialog -c $dname 75 box 129 60 360 180 rounded
    xdid -t $dname 75 Font
    xdid -c $dname 75 76 button 17 20 80 25 notheme vgradient
    xdid -t $dname 76 Change Font
    xdid -c $dname 75 77 listview 17 50 327 72 report fullrow singlesel tooltip grid noheader
    xdid -t $dname 77 + 0 102 Item	+ 0 221 Value
    tokenize 32 $hget(iset,font) 
    xdid -a $dname 77 0 0 +k 0 0 0 0 0 $rgb(241,245,250) Font $chr(9) + 0 0 0 0 $4-
    xdid -a $dname 77 0 0 + 0 0 0 0 0 0 Size $chr(9) + 0 0 0 0 $3
    xdid -a $dname 77 0 0 +k 0 0 0 0 0 $rgb(241,245,250) Character set $chr(9) + 0 0 0 0 $2
    xdid -a $dname 77 0 0 + 0 0 0 0 0 0 Flags $chr(9) + 0 0 0 0 $i.flags($1)
    xdid -f $dname 77 + ansi 10 arial
    xdid -c $dname 75 89 text 18 125 300 40
    xdid -t $dname 89 Example Text
    xdid -f $dname 89 $hget(iset,font)

    xdialog -c $dname 78 box 129 60 360 190 rounded
    xdid -t $dname 78 Rating bar
    xdid -c $dname 78 79 text 17 30 40 16
    xdid -t $dname 79 Style:
    xdid -c $dname 78 80 comboex 80 27 160 100 dropdown
    xdid -a $dname 80 0 0 0 0 0 OS Theme
    xdid -a $dname 80 0 0 0 0 0 Normal
    xdid -a $dname 80 0 0 0 0 0 Smooth
    xdid -a $dname 80 0 0 0 0 0 Gradient
    xdid -c $dname 80 $hget(iset,rbar)
    xdid -c $dname 78 81 text 17 60 50 16
    xdid -t $dname 81 Preview:
    xdid -c $dname 78 82 pbar 80 58 160 20
    xdid -c $dname 78 83 pbar 80 58 160 20 notheme
    xdid -c $dname 78 84 pbar 80 58 160 20 notheme smooth
    xdid -c $dname 78 85 pbar 80 58 160 20 gradient
    xdid -q $dname 82,83,84,85 $hget(iset,rtext)
    xdid -c $dname 83,84 $hget(iset,rcol1)
    xdid -C $dname 85 +g $hget(iset,rcol1)
    xdid -C $dname 85 +G $hget(iset,rcol2)
    xdid -v $dname 82,83,84,85 60
    xdid -i $dname 82,83,84,85 3 Stars
    xdid -f $dname 82,83,84,85 + ansi 10 Trebuchet MS
    xdid -c $dname 78 99 text 17 90 50 16
    xdid -t $dname 99 Color 1:
    xdid -c $dname 78 100 text 80 83 50 30
    xdid -C $dname 100 +b $hget(iset,rcol1)
    xdid -c $dname 78 101 button 140 85 60 25 notheme vgradient
    xdid -t $dname 101 Change
    xdid -c $dname 78 102 text 17 120 50 16
    xdid -t $dname 102 Color 2:
    xdid -c $dname 78 103 text 80 113 50 30
    xdid -C $dname 103 +b $hget(iset,rcol2)
    xdid -c $dname 78 104 button 140 115 60 25 notheme vgradient
    xdid -t $dname 104 Change
    xdid -c $dname 78 51 text 17 155 50 16
    xdid -t $dname 51 Text color:
    xdid -c $dname 78 52 text 80 150 50 25
    xdid -C $dname 52 +b $hget(iset,rtext)
    xdid -c $dname 78 53 button 140 150 60 25 notheme vgradient
    xdid -t $dname 53 Change
    iset.cb $dname sclick 80

    xdialog -c $dname 90 box 129 60 360 190 rounded
    xdid -t $dname 90 Volume bar
    xdid -c $dname 90 91 text 17 30 40 16
    xdid -t $dname 91 Style:
    xdid -c $dname 90 92 comboex 80 27 160 100 dropdown
    xdid -a $dname 92 0 0 0 0 0 OS Theme
    xdid -a $dname 92 0 0 0 0 0 Normal
    xdid -a $dname 92 0 0 0 0 0 Smooth
    xdid -a $dname 92 0 0 0 0 0 Gradient
    xdid -c $dname 92 $hget(iset,vbar)
    xdid -c $dname 90 93 text 17 60 50 16
    xdid -t $dname 93 Preview:
    xdid -c $dname 90 94 pbar 80 58 160 20 
    xdid -c $dname 90 95 pbar 80 58 160 20 notheme
    xdid -c $dname 90 96 pbar 80 58 160 20 notheme smooth
    xdid -c $dname 90 97 pbar 80 58 160 20 gradient
    xdid -q $dname 94,95,96,97 $hget(iset,vtext)
    xdid -c $dname 95,96 $hget(iset,vcol1)
    xdid -C $dname 97 +g $hget(iset,vcol1)
    xdid -C $dname 97 +G $hget(iset,vcol2)
    xdid -v $dname 94,95,96,97 50
    xdid -f $dname 94,95,96,97 + ansi 10 Trebuchet MS
    xdid -c $dname 90 105 text 17 90 50 16
    xdid -t $dname 105 Color 1:
    xdid -c $dname 90 106 text 80 83 50 30
    xdid -C $dname 106 +b $hget(iset,vcol1)
    xdid -c $dname 90 107 button 140 85 60 25 notheme vgradient
    xdid -t $dname 107 Change
    xdid -c $dname 90 108 text 17 120 50 16
    xdid -t $dname 108 Color 2:
    xdid -c $dname 90 109 text 80 113 50 30
    xdid -C $dname 109 +b $hget(iset,vcol2)
    xdid -c $dname 90 110 button 140 115 60 25 notheme vgradient
    xdid -t $dname 110 Change
    xdid -c $dname 90 111 text 17 155 50 16
    xdid -t $dname 111 Text color:
    xdid -c $dname 90 112 text 80 150 50 25
    xdid -C $dname 112 +b $hget(iset,vtext)
    xdid -c $dname 90 113 button 140 150 60 25 notheme vgradient
    xdid -t $dname 113 Change
    iset.cb $dname sclick 92

    xdialog -c $dname 60 panel 0 295 498 50 vgradient
    xdid -C $dname 60 +g $rgb(90,100,116)
    xdid -C $dname 60 +G $rgb(124,134,151)
    xdid -c $dname 60 2 button 395 9 95 24 notheme vgradient
    xdid -t $dname 2 Cancel
    xdid -c $dname 60 61 button 290 9 95 24 notheme vgradient
    xdid -t $dname 61 Ok
    xdid -c $dname 60 13 button 170 9 95 24 notheme vgradient
    xdid -t $dname 13 Restore Defaults

    xdialog -c $dname 87 image 430 0 50 50
    xdid -i $dname 87 + $hget(iset,itunespic)

    xdid -C $dname 6,7,9,11,14,17,19,20,21,31,35,33,36,39,40,41,44,47,48,51,55,56,62,63,66,67,69,75,78,79,81,88,89,90,91,93,99,102,105,108,111,999 +b $rgb(209,215,226)
    xdid -f $dname 6,14,31,36,55,62,66,75,78,90 +b ansi 9 arial
    xdid -C $dname 2,61,13,38,43,46,50,53,58,59,65,76,101,104,107,110,113 +g $rgb(252,253,251)
    xdid -C $dname 2,61,13,38,43,46,50,53,58,59,65,76,101,104,107,110,113 +G $rgb(176,174,174)
    xdid -h $dname 6,13,14,31,36,55,62,66,75,78,90
  }
}
alias iset.cb {
  var %dname = $1,%devent = $2,%did = $3
  if (%devent == sclick) {
    if (%did == 1) {
      var %x = $xdid(%dname,1).seltext
      if ($istok(StartUp|Customize|Icons|Background|Track buttons|Player position|Font|Rating bar|Volume bar,%x,124)) { 
        xdid -t %dname 15 %x 
        xdid -s %dname 13
      }
      else { 
        xdid -t %dname 15 Select a $iif($istok(Options|Appearance,%x,124),Subcategory,Category)
        xdid -h %dname 13
      }
      xdid $iif(%x == StartUp,-s,-h) %dname 6,14 
      xdid $iif(%x == Customize,-s,-h) %dname 31
      xdid $iif(%x == Icons,-s,-h) %dname 36
      xdid $iif(%x == Background,-s,-h) %dname 55
      xdid $iif(%x == Track buttons,-s,-h) %dname 62
      xdid $iif(%x == Player position,-s,-h) %dname 66
      xdid $iif(%x == Font,-s,-h) %dname 75
      xdid $iif(%x == Rating bar,-s,-h) %dname 78
      xdid $iif(%x == Volume bar,-s,-h) %dname 90
    }
    elseif (%did == 2) { dialog -x %dname }
    elseif (%did == 8) {
      if ($4 == 2) {
        xdid -M %dname 1 $xdid(%dname,10).text
        xdid -ra %dname 10 $iif($xdid(%dname,2).mark,$v1,$hget(iset,titlebar.s))
      }
      else {
        xdid -M %dname 2 $xdid(%dname,10).text
        xdid -ra %dname 10 $iif($xdid(%dname,1).mark,$v1,$hget(iset,titlebar.h))
      }
    }
    elseif (%did == 13) {
      var %o,%x = $xdid(%dname,1).seltext
      if (%x == StartUp) { %o = StartUp titlebar.h titlebar.s }
      elseif (%x == Customize) { %o = vol tooltips posedit top volcontrol desk min }
      elseif (%x == Icons) { %o = dicon seticon hicon sicon ticon ricon }
      elseif (%x == Background) { %o = bg }
      elseif (%x == Track buttons) { %o = tcol }
      elseif (%x == Player position) { %o = pbar pcol1 pcol2 ptext }
      elseif (%x == Font) { %o = font }
      elseif (%x == Rating bar) { %o = rbar rcol1 rcol2 rtext }
      elseif (%x == Volume bar) { %o = vbar vcol1 vcol2 vtext }
      tokenize 32 %o
      if ($input(Are you sure you wish to restore to default settings?,nwu,Restore settings)) {
        hdel iset $* 
        i.settings
        var %path = $xdid(%dname,1).selpath
        dialog -x %dname
        dialog -m %dname %dname
        xdid -c %dname 1 %path
        scon -r iset.cb %dname sclick 1
      }

    }
    elseif (%did == 22) {
      xdid $iif($xdid(%dname,22).seltext == Track bar,-s,-h) %dname 24
      xdid $iif($xdid(%dname,22).seltext == Progress bar,-s,-h) %dname 23
    }
    elseif (%did == 37) { xdid $iif($xdid(%dname,37).seltext,-s,-h) %dname 38 }
    elseif (%did == 38) { 
      if (D_ERROR * !iswmcs $dcx(PickIcon,0 shell32.dll)) {
        tokenize 32 $v2
        var %icon = $gettok(dicon seticon hicon sicon ticon ricon,$xdid(%dname,37).sel,32)
        xdid -M %dname 37 $calc($xdid(%dname,37).mark + 1)
        hadd -m iset %icon $2 $nopath($3)
        xdid -w %dname 37 +hdna $2 $nopath($3)
        xdid -W %dname 37 report
        xdid -t %dname 37 + 0 10 text
        xdid -l %dname 37 $xdid(%dname,37).sel 1 $xdid(%dname,37).mark
        xdid -W %dname 37 icon
      }
    }
    elseif (%did == 58) {
      var %c = $dcx(ColorDialog,$iif($hget(iset,bg),$v1,0) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset bg %c
        xdid -h %dname 88
        xdid -s %dname 57
        xdid -C %dname 57 +b %c
      }
    }
    elseif (%did == 59) {
      hadd -m iset bg $false
      xdid -h %dname 57
      xdid -s %dname 88
    }
    elseif (%did == 61) {
      if (!$hget(iset)) { hmake iset } 
      if ($xdid(%dname,1).mark) { hadd iset titlebar.h $v1 }
      if ($xdid(%dname,2).mark) { hadd iset titlebar.s $v1 }
      if ($dialog(itunes)) { dialog -t iTunes $i.titlebar($iif($xdid(itunes,1).mark,s,h)) }
      hadd iset startup $iif($xdid(%dname,18).seltext == Hide,$false,$true)
      hadd iset tooltips $xdid(%dname,33).state
      hadd iset volcontrol $xdid(%dname,20).state
      hadd iset posedit $xdid(%dname,35).state
      hadd iset top $xdid(%dname,999).state 
      hadd iset desk $xdid(%dname,39).state
      hadd iset min $xdid(%dname,40).state
      hadd iset vol $xdid(%dname,47).state
      hadd iset say $xdid(%dname,21).state
      hadd iset pbar $xdid(%dname,68).sel
      hadd iset rbar $xdid(%dname,80).sel
      hadd iset vbar $xdid(%dname,92).sel
      dialog -x %dname
      if ($dialog(itunes)) {
        dialog -x itunes itunes
        .timerTunes off
        closecom m x y i
        var %s = -m
        if ($hget(iset,top)) { %s = %s $+ o }
        if ($hget(iset,desk)) { %s = %s $+ d }
        dialog %s itunes itunes
      }
    }
    elseif (%did == 65) {
      var %c = $dcx(ColorDialog,$hget(iset,tcol) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset tcol %c
        xdid -C %dname 64 +b %c
      }
    }
    elseif (%did == 68) { 
      var %u = $xdid(%dname,68).seltext
      xdid $iif(%u == OS theme,-s,-h) %dname 70
      xdid $iif(%u == Normal,-s,-h) %dname 71
      xdid $iif(%u == Smooth,-s,-h) %dname 72
      xdid $iif(%u == Gradient,-s,-h) %dname 73
      xdid $iif($istok(Normal|Smooth|Gradient,%u,124),-s,-h) %dname 41,42,43
      xdid $iif(%u == Gradient,-s,-h) %dname 44,45,46
    }
    elseif (%did == 43) {
      var %c = $dcx(ColorDialog,$hget(iset,pcol1) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset pcol1 %c
        xdid -c %dname 71,72 %c
        xdid -C %dname 42 +b %c
        xdid -C %dname 73 +g %c
      }
    }
    elseif (%did == 46) {
      var %c = $dcx(ColorDialog,$hget(iset,pcol2) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset pcol2 %c
        xdid -C %dname 45 +b %c
        xdid -C %dname 73 +G %c
      }
    }
    elseif (%did == 50) {
      var %c = $dcx(ColorDialog,$hget(iset,ptext) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset ptext %c
        xdid -q %dname 70,71,72,73 %c
        xdid -C %dname 49 +b %c
      }
    }
    elseif (%did == 53) {
      var %c = $dcx(ColorDialog,$hget(iset,rtext) owner $dialog(%dname).hwnd) 
      if (%c != -1) {
        hadd -m iset rtext %c
        xdid -q %dname 82,83,84,85 %c
        xdid -C %dname 52 +b %c
      }
    }
    elseif (%did == 76) {
      if ($dcx(FontDialog)) {
        tokenize 32 $v1
        hadd -m iset font $2-
        xdid -v %dname 77 1 2 $5-
        xdid -v %dname 77 2 2 $4
        xdid -v %dname 77 3 2 $3
        xdid -v %dname 77 4 2 $i.flags($2)
        xdid -f %dname 89 $2- 
      }
    }
    elseif (%did == 80) {
      var %u = $xdid(%dname,80).seltext
      xdid $iif(%u == OS theme,-s,-h) %dname 82
      xdid $iif(%u == Normal,-s,-h) %dname 83
      xdid $iif(%u == Smooth,-s,-h) %dname 84
      xdid $iif(%u == Gradient,-s,-h) %dname 85
      xdid $iif($istok(Normal|Smooth|Gradient,%u,124),-s,-h) %dname 99,100,101
      xdid $iif(%u == Gradient,-s,-h) %dname 102,103,104
    }
    elseif (%did == 92) {
      var %u = $xdid(%dname,92).seltext
      xdid $iif(%u == OS theme,-s,-h) %dname 94
      xdid $iif(%u == Normal,-s,-h) %dname 95
      xdid $iif(%u == Smooth,-s,-h) %dname 96
      xdid $iif(%u == Gradient,-s,-h) %dname 97
      xdid $iif($istok(Normal|Smooth|Gradient,%u,124),-s,-h) %dname 105,106,107
      xdid $iif(%u == Gradient,-s,-h) %dname 108,109,110
    }
    elseif (%did == 101) {
      var %c = $dcx(ColorDialog,$hget(iset,rcol1) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset rcol1 %c
        xdid -c %dname 83,84 %c
        xdid -C %dname 100 +b %c
        xdid -C %dname 85 +g %c
      } 
    }
    elseif (%did == 104) {
      var %c = $dcx(ColorDialog,$hget(iset,rcol2) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset rcol2 %c
        xdid -C %dname 103 +b %c
        xdid -C %dname 85 +G %c
      }
    }
    elseif (%did == 107) {
      var %c = $dcx(ColorDialog,$hget(iset,vcol1) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset vcol1 %c
        xdid -c %dname 95,96
        xdid -C %dname 106 +b %c
        xdid -C %dname 97 +g %c
      }
    }
    elseif (%did == 110) {
      var %c = $dcx(ColorDialog,$hget(iset,vcol2) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset vcol2 %c
        xdid -C %dname 109 +b %c
        xdid -C %dname 97 +G %c
      }
    }
    elseif (%did == 113) {
      var %c = $dcx(ColorDialog,$hget(iset,vtext) owner $dialog(%dname).hwnd)
      if (%c != -1) {
        hadd -m iset vtext %c
        xdid -q %dname 94,95,96,97 %c
        xdid -C %dname 112 +b %c
      }
    }
  }
  elseif (%devent == dclick) {
    if (%did == 12) { 
      if ($xdid(%dname,12).sel) { xdid -a %dname 10 $xdid(%dname,12,$v1,1).text } 
    }
  }
  elseif (%devent == edit) {
    if (%did == 10) { xdid -M %dname $iif($xdid(%dname,8).sel == 1,1,2) $xdid(%dname,10).text }
  }
  elseif (%devent == help) {
    var %m
    if ($istok(14 17 18 19,%did,32)) { %m = This lets you control whether the info list is hidden of shown when the player is opened. }
    elseif (%did == 1) { %m = You can navigate through different options to customize your iTunes player here. }
    elseif (%did == 6) { %m = Options reguarding the titlebar text. }
    elseif ($istok(7 8,%did,32)) { %m = This allows you to change the titlebar text when the track info list is either hidden or shown. }
    elseif ($istok(9 10,%did,32)) { %m = This allows you to edit the text of the titlebar respectivly when the list is hidden or shown. }
    elseif ($istok(11 12,%did,32)) { %m = These are identifiers you can use in the titlebar text that represent values described here. }
    elseif (%did == 33) { %m = This allows you to enable/disable tooltips which are displayed either in the toolbar to describe their functions. }
    elseif (%did == 35) { %m = This allows you to enable/disable the ability to change the player position during playback. }
    elseif (%did == 999) { %m = This allows you to keep the player on top of everything so you can focus on another window and still view the player. }
    elseif (%did == 20) { %m = This allows you to enable/disable the ability to change the volume. }
    elseif (%did == 39) { %m = This allows you to open the player as a desktop window so it can seperate from mIRC. }
    elseif (%did == 40) { %m = This allows you to add minimize/restore buttons the the player to allow it to be minimized. }
    elseif (%did == 47) { %m = This allows you to choose whether the volume bar will be seen when the info list is hidden. }
    elseif ($istok(37 38,%did,32)) { %m = This allows you to change the selected icon in the player. }
    elseif ($istok(55 56 88 57,%did,32)) { %m = This shows you the current background color of the player. }
    elseif (%did == 58) { %m = This lets you change the background color for the player. }
    elseif (%did == 59) { %m = This lets you change the background color of the player to no fill. }
    elseif ($istok(62 63 64,%did,32)) { %m = This shows you the current color of the playback buttons. }
    elseif (%did == 65) { %m = This lets you change the playback button color. }
    elseif ($istok(66 67 68,%did,32)) { %m = This lets you change the style of the player position bar (song progress bar). }
    elseif ($istok(69 70 71 72 73,%did,32)) { %m = This is a preview of what the player position bar (song progress bar) will look like. }
    elseif ($istok(41 42,%did,32)) { %m = This shows you the primary color of the progress bar for Normal, Smooth, and Gradient styles. }
    elseif (%did == 43) { %m = This lets you change the primary color. }
    elseif ($istok(44 45,%did,32)) { %m = This shows you the secondary color for the Gradient style. }
    elseif (%did == 46) { %m = This lets you change the secondary color. }
    elseif (%did == 76) { %m = This lets you change the font for the Progress bars and the Track Info list. }
    elseif ($istok(75 77,%did,32)) { %m = This shows you the current font of the Progress bars and the Track Info list. }
    elseif (%did == 89) { %m = This is a preview of the current font. }
    elseif ($istok(78 79 80,%did,32)) { %m = This lets you change the style of the rating bar. }
    elseif ($istok(81 82 83 84 85,%did,32)) { %m = This is a preview of what the rating bar will look like. }
    elseif ($istok(99 100,%did,32)) { %m = This shows you the primary color of the progress bar for Normal, Smooth, and Gradient styles. }
    elseif (%did == 101) { %m = This lets you change the primary color. }
    elseif ($istok(102 103,%did,32)) { %m = This shows you the secondary color for the Gradient style. }
    elseif (%did == 104) { %m = This lets you change the secondary color. }
    elseif ($istok(90 91 92,%did,32)) { %m = This lets you change the style of the volume bar. }
    elseif ($istok(93 94 95 96 97,%did,32)) { %m = This is a preview of what the volume bar will look like. }
    elseif ($istok(105 106,%did,32)) { %m = This shows you the primary color of the progress bar for Normal, Smooth, and Gradient styles. }
    elseif (%did == 107) { %m = This lets you change the primary color. }
    elseif ($istok(108 109,%did,32)) { %m = This shows you the secondary color for the Gradient style. }
    elseif (%did == 110) { %m = This lets you change the secondary color. }
    elseif (%did == 15) { %m = This describes the current setting you are editing. }
    elseif (%did == 13) { %m = This button will restore the default settings ONLY for the setting you are currently viewing. }
    elseif (%did == 61) { %m = Closes the settings dialog and saves any changes that were made. }
    elseif (%did == 2) { %m = Closes the settings dialog and discards any changes made. }
    if (%m) { noop $input(%m,oiu,Help) }
  }
}
dialog icon {
  Title "Downloading icons..."
  size -1 -1 173 33
  option dbu
}
on *:dialog:icon:init:*:{ 
  dcx Mark $dname icon.cb
  xdialog -c $dname 1 pbar 7 35 331 20 marquee
  xdid -i $dname 1 
  xdid -mo $dname 1 25

  xdialog -c $dname 2 text 7 8 331 16
  xdid -t $dname 2 0 of 3 icons complete.
  xdid -f $dname 2 + ansi 10 arial
}
alias icon.cb { }
alias i.set {
  i.settings
  dialog $iif($dialog(iset),-v,-m) iset iset
}
alias i.ready {
  if (!$isfile($hget(iset,volpic))) || (!$isfile($hget(iset,mutepic))) || (!$isfile($hget(iset,itunespic))) { return $false }
  else { return $true }
}
alias itunes {
  i.settings
  if ($dcx(Version)) {
    if (!$i.ready) {
      if (!$isdir(iTunes)) { mkdir itunes }
      dialog -m icon icon
      sockopen icon1 img87.imageshack.us 80 | sockmark icon1 /img87/2176/volmuteym1.png
      sockopen icon2 img87.imageshack.us 80 | sockmark icon2 /img87/214/volur8.png
      sockopen icon3 img183.imageshack.us 80 | sockmark icon3 /img183/3452/ituneslogo3xg7.jpg
      .timericon 0 0 iconcheck
    }
    else {     
      if (!$dialog(itunes)) {
        var %u = -m
        if ($hget(iset,desk)) { %u = %u $+ d }
        if ($hget(iset,top)) { %u = %u $+ o }
        dialog %u itunes itunes
      }
      else { dialog -v itunes }
    }
  }
  else { noop $input(You do not have DCX.dll in your mIRC directory. $crlf $+ Download it at $crlf $+ http://dcx.scriptsdb.org/archive.htm,ohu,Error) }
}
alias getids {
  var %a = 1
  while (%a <= 115) {
    if (!$xdialog(iset,%a).isid) { echo -a Id: %a }
    inc %a
  }
}
alias -l closecom {
  if ($0 > 1) { scon -r closecom $* }
  elseif ($com($1)) { .comclose $1 }
}
alias -l i.settings { 
  if (!$isdir(itunes)) { mkdir itunes }
  if (!$hget(iset)) { hmake iset }
  if (!$hfind(iset,titlebar.h)) { hadd iset titlebar.h <artist> - <track> }
  if (!$hfind(iset,titlebar.s)) { hadd iset titlebar.s iTunes Player v<version> }
  if (!$hfind(iset,startup)) { hadd iset startup $false }
  if (!$hfind(iset,vol)) { hadd iset vol 1 }
  if (!$hfind(iset,volcontrol)) { hadd iset volcontrol 1 }
  if (!$hfind(iset,tooltips)) { hadd iset tooltips 1 }
  if (!$hfind(iset,posedit)) { hadd iset posedit 1 }
  if (!$hfind(iset,top)) { hadd iset top 0 }
  if (!$hfind(iset,desk)) { hadd iset desk 0 }
  if (!$hfind(iset,min)) { hadd iset min 0 }
  if (!$hfind(iset,say)) { hadd iset say 1 }
  if (!$hfind(iset,dicon)) { hadd iset dicon 0 C:\Program Files\iTunes\iTunes.exe }
  if (!$hfind(iset,seticon)) { hadd iset seticon 42 $mircexe }
  if (!$hfind(iset,hicon)) { hadd iset hicon 131 shell32.dll }
  if (!$hfind(iset,sicon)) { hadd iset sicon 137 shell32.dll }
  if (!$hfind(iset,ticon)) { hadd iset ticon 157 shell32.dll }
  if (!$hfind(iset,ricon)) { hadd iset ricon 86 shell32.dll }
  if (!$hfind(iset,sayicon)) { hadd iset sayicon 168 shell32.dll }
  if (!$hfind(iset,bg)) { hadd iset bg $false }
  if (!$hfind(iset,tcol)) { hadd iset tcol 0 }
  if (!$hfind(iset,pbar)) { hadd iset pbar 1 }
  if (!$hfind(iset,pcol1)) { hadd iset pcol1 $rgb(255,0,0) }
  if (!$hfind(iset,pcol2)) { hadd iset pcol2 $rgb(255,130,0) }
  if (!$hfind(iset,ptext)) { hadd iset ptext $rgb(0,0,0) }
  if (!$hfind(iset,font)) { hadd iset font + ansi 10 Trebuchet MS }
  if (!$hfind(iset,rbar)) { hadd iset rbar 3 }
  if (!$hfind(iset,rcol1)) { hadd iset rcol1 $rgb(255,0,0) }
  if (!$hfind(iset,rcol2)) { hadd iset rcol2 $rgb(255,130,0) }
  if (!$hfind(iset,rtext)) { hadd iset rtext $rgb(0,0,0) }
  if (!$hfind(iset,vbar)) { hadd iset vbar 4 }
  if (!$hfind(iset,vcol1)) { hadd iset vcol1 $rgb(68,108,143) }
  if (!$hfind(iset,vcol2)) { hadd iset vcol2 $rgb(112,177,235) }
  if (!$hfind(iset,vtext)) { hadd iset vtext $rgb(0,0,0) }
  if (!$hfind(iset,dcx)) { hadd iset dcx $iif($isfile(itunes\dcx.dll),$mircdiritunes\dcx.dll,$findfile($mircdir,dcx.dll,1)) }
  if (!$hfind(iset,volpic)) { hadd iset volpic $iif($isfile(itunes\vol.png),$mircdiritunes\vol.png,$findfile($mircdir,vol.png,1)) }
  if (!$hfind(iset,mutepic)) { hadd iset mutepic $iif($isfile(itunes\volmute.png),$mircdiritunes\volmute.png,$findfile($mircdir,volmute.png,1)) }
  if (!$hfind(iset,itunespic)) { hadd iset itunespic $iif($isfile(itunes\itunes.png),$mircdiritunes\itunes.png,$findfile($mircdir,itunes.png,1)) }
}
alias -l i.titlebar {
  var %x,%o = $hget(iset,titlebar. $+ $1),%i = 1
  if ($regex(%o,/<(track|artist|album|time|count|rate|vol|pos)>/ig)) {
    while ($regml(%i)) {
      %x = $addtok(%x,$v1,44)
      inc %i
    }
    %i = $getinfo( [ %x ] )
    %o = $regsubex(%o,/<(track|artist|album|time|count|rate|vol|pos)>/ig,$gettok(%i,\n,149))
  }
  else { getinfo }
  return $replace(%o,<version>,4.0,<mversion>,$version,<author>,Brando)
}
alias -l i.flags { return $iif($left($regsubex($remove($1,+),/(\w)/g,$+($iif(\1 == b,Bold,$iif(\1 == i,Italic,$iif(\1 == u,Underline))),$chr(44),$chr(32))),-2),$v1,None) }
alias -l iconcheck {
  if (!$sock(icon*,0)) {
    dialog -x icon
    .timericon off
    dialog -m itunes itunes
  }
  else { xdid -t icon 2 $calc(3 - $sock(icon*,0)) of 3 icons complete. }
}
alias -l GetInfo {
  closecom x y
  .comopen x itunes.application
  var $&
    %% = $com(x,PlayerPosition,2),%pos = $com(x).result, $&
    %% = $com(x,PlayerState,2),%state = $com(x).result, $&
    %% = $com(x,CurrentTrack,2)
  xdid -v itunes 1 2 $iif(%state,;,4)
  xdid -q itunes 1 2 $iif(%state,Pause,Play)
  if ($com(x).result) {
    noop $com(x,SoundVolume,2)
    var %vol = $com(x).result
    xdid -v itunes 6 %vol
    .comclose x $com(x,CurrentTrack,3,dispatch* y)
    var $&
      %% = $com(y,Name,2),%track = $iif($com(y).result,$v1,N/A), $&
      %% = $com(y,Time,2),%time = $com(y).result, $&
      %% = $com(y,Artist,2),%artist = $iif($com(y).result,$v1,N/A), $&
      %% = $com(y,Album,2),%album = $iif($com(y).result,$v1,N/A), $&
      %% = $com(y,PlayedCount,2),%count = $com(y).result, $&
      %% = $com(y,Rating,2),%rate = $com(y).result
    var %info = $xdid(itunes,3,1,2).text $xdid(itunes,3,2,2).text $xdid(itunes,3,3,2).text $xdid(itunes,3,4,2).text $xdid(itunes,3,5,2).text $xdid(itunes,3,6,2).text
    if ($len(%info) != $len(%track %time %artist %album %count)) || (%track !isin %info) {
      xdid -r itunes 3
      xdid -a itunes 3 0 0 +k 1 0 0 0 0 $iif($xdid(itunes,3).num & 1,$rgb(255,255,255),$rgb(225,234,244)) Track $chr(9) + 0 0 0 0 %track
      xdid -a itunes 3 0 0 +k 1 0 0 0 0 $iif($xdid(itunes,3).num & 1,$rgb(255,255,255),$rgb(225,234,244)) Time $chr(9) + 0 0 0 0 %time
      xdid -a itunes 3 0 0 +k 1 0 0 0 0 $iif($xdid(itunes,3).num & 1,$rgb(255,255,255),$rgb(225,234,244)) Artist $chr(9) + 0 0 0 0 %artist
      xdid -a itunes 3 0 0 +k 1 0 0 0 0 $iif($xdid(itunes,3).num & 1,$rgb(255,255,255),$rgb(225,234,244)) Album $chr(9) + 0 0 0 0 %album
      xdid -a itunes 3 0 0 +k 1 0 0 0 0 $iif($xdid(itunes,3).num & 1,$rgb(255,255,255),$rgb(225,234,244)) Count $chr(9) + 0 0 0 0 %count
      xdid -a itunes 3 0 0 + 2 0 0 0 0 0 Rating $chr(9) +p 0 0 0 0 $iif($hget(iset,rbar) == 2,notheme,$iif($v1 == 3,notheme smooth,$iif($v1 == 4,gradient)))
      xdid -v itunes 3 6 2 -v %rate
      xdid -v itunes 3 6 2 -i $calc(%rate / 20) Stars
      xdid -v itunes 3 6 2 -c $hget(iset,rcol1)
      xdid -v itunes 3 6 2 -q $hget(iset,rtext)
      xdid -v itunes 3 6 2 -C +g $hget(iset,rcol1)
      xdid -v itunes 3 6 2 -C +G $hget(iset,rcol2)
    }
    xdid -v itunes 2 $int($calc(%pos / $duration(%time) * 100))
    %% = $duration(%pos,3)
    xdid -i itunes 2 $iif($gettok(%%,1,58),%%,$deltok(%%,1,58)) / %time
  }
  else {
    .timerTunes off
    closecom x y
  }
  if ($isid) {
    var %u,%i = 1
    while (%i <= $0) {
      %u = $addtok(%u,% [ $+ [ $ [ $+ [ %i ] ] ] ],149)
      inc %i
    }
    return %u
  }
}
on *:start:{
  if (!$hget(iset)) { hmake iset }
  if ($isfile(itunes\iset.dat)) { hload iset itunes\iset.dat }
  i.settings
}
on *:exit:{ hsave iset itunes\iset.dat }
on *:load:{
  i.settings
  if (!$dcx(Version)) { noop $input(You do not have DCX.dll in your mIRC directory. $crlf $+ Download it at $crlf $+ http://dcx.scriptsdb.org/archive.htm,ohu,Error) }
  elseif (!$i.ready) {
    mkdir itunes
    dialog -m icon icon
    sockopen icon1 img87.imageshack.us 80 | sockmark icon1 /img87/2176/volmuteym1.png
    sockopen icon2 img87.imageshack.us 80 | sockmark icon2 /img87/214/volur8.png
    sockopen icon3 img183.imageshack.us 80 | sockmark icon3 /img183/3452/ituneslogo3xg7.jpg
    .timericon 0 0 iconcheck
  }
}
on *:unload:{
  hfree -w iset
  dll -u $qt($hget(iset,dcx))
  noop $findfile($mircdiriTunes,*,0,.remove $qt($1-))
  rmdir iTunes
}
menu status,channel,menubar,query {
  iTunes
  .iTunes Player:{ itunes }
  .Settings:{ i.set }
}
on *:sockopen:icon*:{
  sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.0
  sockwrite $sockname Host: $sock($sockname).addr $+ $str($crlf,2)
}
on *:sockread:icon*:{
  tokenize 32 $sock($sockname).mark
  if ($0 < 2) {
    var %g = $true
    while (%g) {
      sockread %g
      if (Content-len isin %g) { sockmark $sockname $1 $gettok(%g,2,32) }
    }
  }
  else {
    var %f = iTunes\ $+ $iif(mute isin $1,volmute.png,$iif(itunes isin $1,itunes.png,vol.png))
    while ($sock($sockname).rq) {
      sockread &i
      bwrite %f -1 -1 &i
    }
    if ($lof(%f) >= $2) { sockclose $sockname }
  }
}
; DCX commands
alias dcx {
  if ($isid) returnex $dll($hget(iset,dcx),$1,$2-)
  else dll $qt($hget(iset,dcx)) $1 $2-
}
alias xdid {
  if ( $isid ) returnex $dcx( _xdid, $1 $2 $prop $3- )
  dcx xdid $2 $3 $1 $4-
}
alias xdialog {
  if ( $isid ) returnex $dcx( _xdialog, $1 $prop $2- )
  dcx xdialog $2 $1 $3-
}