All pastes #915237 Raw Edit

Unnamed

public text v1 · immutable
#915237 ·published 2008-02-23 17:23 UTC
rendered paste body
   
      alias -l c1 { return $+($chr(3),07) }
   
      alias -l c2 { return $+($chr(3),14) }
   
      alias -l c3 { return $+($chr(3),04) }
   
      alias -l c4 { return $+($chr(3),12) }
   
      alias -l l { return $+($chr(2),$c3,»,$chr(3),$chr(2)) }
   
      alias -l ll { return $+($c2,$1-,$c3,:,$c1) }
   
      alias -l it { return $+($c2,[,$c4,iTunes,$c2,],$chr(2),$c3 —›,$chr(2)) }
   
      alias -l lll { return $+($c2,[,$c1,$1-,$c2,]) }
   
      alias itunes { _iTunes | .timeriTunes 0 480 noop $!_itunes }
  
      alias itunesoff { .timeriTune* off }
  
       
  
      alias _itunes {
  
        if (!$chkprg(iTunes.exe)) {
  
          if (!$isid) {
  
            var %x = $?!="Would you like to run iTunes?"
  
            if (%x) { run iTunes.exe | echo -at $c1 $+ ** $it $+($c2,Now running,$chr(32),$c1,iTunes.exe,$c2,. Type /itunes again when iTunes finishes opening and you have started playing music.) }
  
            else { echo -at $c1 $+ ** $it $+ $c2 No action taken.  }
  
          }
  
          .timeriTune* off
  
          return
  
        }
  
        scid $activecid
  
        var %p = iTunes, %i = IITTrack, %b = $chr(2), %% = $+(%b,$c3,1»,$chr(3),%b), $&
  
          %chans = #pc #idle #irchelp #rsmarket
  
        .comopen iTunes iTunes.Application
  
        if ($comerr) { .timeriTunes off | return }
  
        if $com(%p,CurrentTrack,3,dispatch* %i) {
 
          var %k = $com(%i,Name,2), %name = $com(%i).result, $&
 
            %k = $com(%i,Album,2), %album = $com(%i).result, $&
  
            %k = $com(%i,Artist,2), %artist = $com(%i).result, $&
  
            %k = $com(%i,Time,2), %time = $regsubex($com(%i).result,/(\d+):(\d+)/,$+(01\1,$c2,12:,$c1,01\2)), $&
  
            %k = $com(%i,Rating,2), %n = $com(%i).result, $&
  
            %k = $com(%i,Year,2), %year = $com(%i).result
  
          var %k = $com(%i,Duration,2), %k = $com(%p,PlayerPosition,2), $&
  
            %pr = $calc($com(%p).result  / $com(%i).result), $&
  
            %position = $regsubex($asctime($com(%p).result,12n01:12ss) ,/(\d+):(\d+)/,$+(01\1,$c2,12:,$c1,01\2)), $&
  
            %k = $com(%p,PlayerState,2), %st = $com(%p).result, $&
  
            %k = $com(%i,Genre,2), %genre = $com(%i).result, $&
  
            %k = $com(%i,PlayedCount,2), %played = $com(%i).result
  
          var %msg = 01[12iTunes01]12 —› 12Track:01 %name  $&
  
            %% 12Artist:01 %artist  $&
  
            %% 12Album:01 %album $&
  
            %% 12Position: $+(%position,$c2,12/,$c1,%time) $&
  
            %% 12Genre:01 %genre $&
  
            %% 12PlayedCount:01 %played $+ $chr(15)
  
          $iif($active ischan && !$istok(%chans,$active,32),msg $active,noop) $iif(c !isincs $chan($active).mode,%msg,$strip(%msg,c)))
  
        }
  
        :error
  
        while ($com(0)) { .comclose $com(1) }
  
      }
  
       
  
      alias pause {
  
        if (!$chkprg(iTunes.exe)) { return }
  
        .comopen iTunes iTunes.Application
  
        noop $com(iTunes,Pause,3)
  
        echo -at $c1 $+ ** $it $c2 $+ Music Paused.
  
        .comclose iTunes
  
      }
  
       
  
      alias resume {
  
        if (!$chkprg(iTunes.exe)) { return }
  
        .comopen iTunes iTunes.Application
  
        noop $com(iTunes,Play,3)
  
        echo -at $c1 $+ ** $it $c2 $+ Music Resumed.
  
        .comclose iTunes
  
      }
  
       
  
      alias setrating {
  
        if (!$1) { return }
  
        var %p = iTunes, %i = IITTrack
  
        .comopen iTunes iTunes.Application
  
        if ($comerr) { .timeriTunes off | return }
  
        if $com(%p,CurrentTrack,3,dispatch* %i) {
  
          var %k = $com(%i,Rating,4,long,$calc($1 *20)), $&
  
            %k = $com(%i,Name,2), %n = $com(%i).result
  
          echo -at $c1 $+ ** $it $+($c2,Rating for:,$c1,$chr(32),%n,$chr(32),$c2,changed to,$c1,$chr(32),$1,$c2,.)
  
        }
  
        :error
  
        while ($com(0)) { .comclose $com(1) }
  
      }
  
       
  
      alias next {
  
        if (!$chkprg(iTunes.exe)) { return }
  
        var %p = iTunes, %i = IITTrack
  
        .comopen iTunes iTunes.Application
  
        if ($comerr) { .timeriTunes off | return }
  
        if $com(%p,CurrentTrack,3,dispatch* %i) {
  
          var %k = $com(%p,NextTrack,3)
  
          .timer 1 .5 _next
  
        }
  
        while ($com(0)) { .comclose $com(1) }
  
      }
  
       
  
      alias back {
  
        if (!$chkprg(iTunes.exe)) { return }
  
        var %p = iTunes, %i = IITTrack
  
        .comopen iTunes iTunes.Application
  
        if ($comerr) { .timeriTunes off | return }
  
        if $com(%p,CurrentTrack,3,dispatch* %i) {
 
          var %k = $com(%p,PreviousTrack,3)
 
          .timer 1 .5 _back
 
        }
 
        while ($com(0)) { .comclose $com(1) }
 
      }
 
       
 
      alias -l _back {
 
        var %p = iTunes, %i = IITTrack
 
        .comopen iTunes iTunes.Application
 
        if ($comerr) { .timeriTunes off | return }
 
        if $com(%p,CurrentTrack,3,dispatch* %i) {
 
          var %k = $com(%i,Name,2)
 
          echo -at $c1 $+ ** $it $+($c2,Advanced to previous track:,$c1) $com(%i).result
 
        }
 
        while ($com(0)) { .comclose $com(1) }
 
      }
 
       
 
      alias -l _next {
 
        var %p = iTunes, %i = IITTrack
 
        .comopen iTunes iTunes.Application
 
        if ($comerr) { .timeriTunes off | return }
 
        if $com(%p,CurrentTrack,3,dispatch* %i) {
 
          var %k = $com(%i,Name,2)
 
          echo -at $c1 $+ ** $it $+($c2,Advanced to next track:,$c1) $com(%i).result
 
        }
 
        while ($com(0)) { .comclose $com(1) }
 
      }
 
       
 
      alias chkprg {
 
        .fopen -o processes processes.txt
 
        .fclose processes
 
        var %% = aline @@, %x = processes.txt
 
        window -h @@
 
        %% Dim z, x, t
 
        %% Set z = CreateObject("Scripting.FileSystemObject")
 
        %% Set x = z.OpenTextFile(" $+ $mircdir $+ %x $+ ", 2, 1)
 
        %% t = "."
 
        %% For Each obj In GetObject("winmgmts://" & t & "/root/cimv2").ExecQuery("SELECT * FROM Win32_Process")
 
        %% x.Write(obj.Description & vbCrLf)
 
        %% Next
 
        savebuf @@ pro.vbs
 
        window -c @@
 
        .comopen q wscript.shell
 
        .comclose q $com(q,run,3,bstr,wscript " $+ $mircdir $+ pro.vbs",uint,5,bool,true)
 
        return $read(processes.txt,r,$1)