All pastes #583615 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-22 13:29 UTC
rendered paste body
on *:START:{
  if (%np.ontop == on) {
    /dialog -mdieo npRemote npRemote
  }
  else {
    /dialog -mdien npRemote npRemote
  }
}

on *:LOAD:{
  %np.ontop = on
  %np.lyrics = on
  /dialog -mdieo npRemote npRemote
}


alias gettrack {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack)

  .echo -q $com(CurrentTrack,Artist,3)
  %artist = $com(CurrentTrack).result

  .echo -q $com(CurrentTrack,Album,3)
  %album = $com(CurrentTrack).result

  .echo -q $com(CurrentTrack,Name,3)
  %title = $com(CurrentTrack).result

  %output = iTunes Now Playing ~ Artist  $+ %artist ~ Title  $+ %title

  %subbedTitle = $replace(%title,$chr(32),$chr(37) $+ 20)
  %subbedTitle = $remove(%subbedTitle,&)

  if (%np.lyrics == on) {
    %output = %output - lyrics @ http://binzlyrics.lir.dk/?t= $+ %subbedTitle
  }

  return %output

}

alias getcbtrack {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack)

  .echo -q $com(CurrentTrack,Artist,3)
  %artist = $com(CurrentTrack).result

  .echo -q $com(CurrentTrack,Album,3)
  %album = $com(CurrentTrack).result

  .echo -q $com(CurrentTrack,Name,3)
  %title = $com(CurrentTrack).result

  %output = $chr(91) %artist - %title $chr(93)

  %subbedTitle = $replace(%title,$chr(32),$chr(37) $+ 20)
  %subbedTitle = $remove(%subbedTitle,&)

  if (%np.lyrics == on) {
    %output = %output - lyrics @ http://binzlyrics.lir.dk/?t= $+ %subbedTitle
  }

  return %output

}


alias np {
  /scid $activecid msg $active $gettrack
}

alias enp {
  echo -a iTunes np: $gettrack
}

alias npClipboard {
  clipboard iTunes np: $getcbtrack
}

menu channel,query,chat {
  .Now playing:/np
}

menu status,channel,query,nicklist,menu,chat {
  .npRemote:{
    if (%np.ontop == on) {
      /dialog -mdieo npRemote npRemote
    }
    else {
      /dialog -mdien npRemote npRemote
    }

  }

}

dialog npRemote {
  title "npRemote iTunes"
  size -1 -1 184 90
  option pixels

  button "< prev", 1, 0 0 40 20, push
  button "play/pause", 2, 40 0 70 20, push
  button "stop", 3, 110 0 30 20, push
  button "next >", 4, 140 0 44 20, push
  button "np", 5, 0 20 27 20
  button "echo np", 6, 27 20 57 20, push
  button "np to clipboard", 7, 84 20 100 20, push
  button remote always on top: %np.ontop, 8, 0 45 184 20, push
  button lyrics in np output: %np.lyrics, 9, 0 70 184 20, push
}

alias /- {
  if (!$com(itunes)) {
    /comopen itunes iTunes.Application
  }
  %com.result = $com(itunes,PreviousTrack,3)
  if (%com.result==0) {
    echo -a npRemote error: Make sure iTunes is open.
  }
}

on *:DIALOG:npRemote:SCLICK:2:{
  if (!$com(itunes)) {
    .comopen itunes iTunes.Application
  }
  %com.result = $com(itunes,PlayPause,3)
  if (%com.result==0) {
    echo -a npRemote error: Make sure iTunes is open.
  }

}

on *:DIALOG:npRemote:SCLICK:3:{
  if (!$com(itunes)) {
    .comopen itunes iTunes.Application
  }
  %com.result = $com(itunes,Stop,3)
  if (%com.result==0) {
    echo -a npRemote error: Make sure iTunes is open.
  }
}

;on *:DIALOG:npRemote:SCLICK:4:{
alias /+ {
  if (!$com(itunes)) {
    .comopen itunes iTunes.Application
  }
  %com.result = $com(itunes,NextTrack,3)
  if (%com.result==0) {
    echo -a npRemote error: Make sure iTunes is open.
  }
  /enp
}

on *:DIALOG:npRemote:SCLICK:5:{
  /np
}

on *:DIALOG:npRemote:SCLICK:6:{
  /npEcho
}

on *:DIALOG:npRemote:SCLICK:7:{
  /npClipboard
}

on *:DIALOG:npRemote:SCLICK:8:{
  if (%np.ontop == on) {
    %np.ontop = off
    /dialog -n npRemote npRemote
    /did -r npRemote 8
    /did -a npRemote 8 remote always on top: %np.ontop
  }
  else {
    %np.ontop = on
    /dialog -o npRemote npRemote
    /did -r npRemote 8
    /did -a npRemote 8 remote always on top: %np.ontop
  }
}

on *:DIALOG:npRemote:SCLICK:9:{
  if (%np.lyrics == on) {
    %np.lyrics = off
    /did -r npremote 9
    /did -a npremote 9 lyrics in np output: %np.lyrics
  }
  else {
    %np.lyrics = on
    /did -r npremote 9
    /did -a npremote 9 lyrics in np output: %np.lyrics
  }
}

on *:DIALOG:npRemote:close:*:{
  if ($com(itunes)) {
    .comclose itunes
  }
}