/NP ***IMPROVED*** (ITUNES /np script along with /sing (/sing are mostly meant for roleplaying and such))

By The6PuffPack on Jan 08, 2012

WELL,
This is actualy one of my best scripts yet.. I honestly don't see how it's useful.. it only mentions what you're listening to and such.. Positive comments please!

thank you AbcdefMonkey for the little "adjustment"

alias itunes {
  ;--Opens iTunes--;
  if ($1 == open) { .comopen itunes itunes.application | .echo -a $comerr }

  ;--Activates the play button within iTunes--;
  if ($1 == play) { .set %play $com(itunes,PlayPause,3) | $track }
  else { .echo -a iTunes may not be open. | halt }

  ;--Plays the next track--;
  if ($1 == Next) { .set %next $com(itunes,NextTrack,3) | $track }
  else { .echo -a iTunes may not be open. | halt  }

  ;--Plays the previous track--;
  if ($1 == Previous) { .set %Previous $com(itunes,PreviousTrack,3) | $track }
  else { .echo -a iTunes may not be open. | halt  }

  ;--Stops the current track--;
  if ($1 == Stop) { .set %stop $com(itunes,Stop,3) }
  else { .echo -a iTunes may not be open. | halt  }
}

alias np {
  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)
  .set %artist $com(CurrentTrack).result
  .echo -q $com(CurrentTrack,Album,3)
  .set %album $com(CurrentTrack).result
  .echo -q $com(CurrentTrack,Name,3)
  .set %name $com(CurrentTrack).result
  /me 11[15iTunes11] 4np: 9 %name 4by: 8 %artist 6from: 7 %album 3at 2 $timestamp
}
alias sing {
  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)
  .set %artist $com(CurrentTrack).result
  .echo -q $com(CurrentTrack,Album,3)
  .set %album $com(CurrentTrack).result
  .echo -q $com(CurrentTrack,Name,3)
  .set %name $com(CurrentTrack).result
  /me 4sings: 9 %name 4by: 8 %artist 6from: 7 %album 3at 2 $timestamp with 11[15iTunes11]
}

Comments

Sign in to comment.
Abcdefmonkey   -  Mar 10, 2012

Well, I'll be fair and say there's numerous iTunes scripts out there. None of them are original in any way, due to the fact the same process to grab the information desired is the same. If it's ripped, oh well, it's not like there aren't 20+ other copies of NP scripts floating around. Personally, I don't use iTunes to play music, so I don't have a use for it. I only provided my knowledge/help above. :p

 Respond  
Sorasyn   -  Mar 10, 2012

The 2 snippets pale in comparison. Snippets that perform the same task often look alike.

 Respond  
KilllerX   -  Mar 09, 2012

.> This looks very similar to one I used, but it didn't have all the

;--does this crap--;

I claim it was taken from somewhere else. after all > http://www.hawkee.com/snippet/7027/ is the same without the notes, and the sing... which is just a simple add, that anybody could really do.

then you used | instead of spacing it out, to make it more cluttered.

:/ very original.

 Respond  
Abcdefmonkey   -  Jan 14, 2012

It's on every line almost... :|

if ($1 == play) { .set %play $com(itunes,PlayPause,3) | $track }

$track -.-

 Respond  
The6PuffPack   -  Jan 14, 2012

Oh nvm.. can you just point out the line to me? I think I found it.. like (I think the comment never posted) I'm more focused on creating my irc server.. I need to buy a domain though. so I'm paying more attention to my money and such.. VERY confusing..

 Respond  
The6PuffPack   -  Jan 14, 2012

Do you mind posting it to the comments. I'm beyond confused. At the moment, I'm attempting to create an irc server.. and I'm more focused on how much money I have to buy the domain.

 Respond  
Abcdefmonkey   -  Jan 09, 2012

Glad to see you finally updated the snippet... :/ ... But I must ask, did you not read what I said fully? You have failed to include the "TRACK" alias that you're using within this snippet. From my view, without it, this snippet is kind of useless. Oh, and one more thing I noticed. Why are you echo'ing $comerr back? No need to echo it. It only has to be called after a .com.

 Respond  
The6PuffPack   -  Jan 09, 2012

And I meant for me to be nagging.. not him. <_<
too many ands... xD

 Respond  
Abcdefmonkey   -  Jan 09, 2012

Haha. What Blackvenom666 :P

 Respond  
blackvenomm666   -  Jan 08, 2012

O_O

 Respond  
Firstmate   -  Jan 08, 2012

I'm pretty sure this is a rip (apologies if not). I've had this little snippet in my remotes that I got from someone for a long time:

alias np {
  if (!$com(itunes)) { .comopen itunes iTunes.Application }
  if ($com(CurrentTrack)) { .comclose CurrentTrack }
  noop $com(itunes,CurrentTrack,3,dispatch* CurrentTrack)
  noop $com(CurrentTrack,Artist,3)
  var %artist $com(CurrentTrack).result
  noop $com(CurrentTrack,Time,3)
  var %time $com(CurrentTrack).result
  noop $com(CurrentTrack,Name,3)
  var %name $com(CurrentTrack).result
  noop $com(CurrentTrack,BitRate,3)
  var %bitrate $com(CurrentTrack).result
  me Now Playing: Artist: %artist Track: %name Time: %time Bitrate: %bitrate
  .comclose CurrentTrack
} 
 Respond  
Abcdefmonkey   -  Jan 08, 2012

Actually, the whole iTunes alias is a cluster f--k waiting to happen. He's not nagging. If you would've taken the time to look you closed the alias off before it even finishes checking everything. Like he said, all of the if statements after the first one are just not going to work at all. Why? You didn't even close off the if statements.. Honestly, they should be else statements in my opinion and just remove the !%var stuff all together... Oh and I see that there's a "/track" which would imply there's a "track" alias which isn't included in the coding at all. Also, why use a / to make it do an alias? $track works perfectly.

Also, if you look at your alias on line 26 there's a 3 on the outside of the bracket

}3

The alias doesn't even recognize that bracket. Deleting the 3 returns a bracket mismatch error at that point (I done this personally). I see no improvement. Are you sure you made this? Because you don't seem to be defending the fact it's messed up or even taken the action of fixing and cleaning it up.. but here... I'll do it for you..

alias itunes {
  ;Opens iTunes
  if ($1 == open) {
    .comopen itunes itunes.application
    .echo -a $comerr
  }

  ;Activates the play button within iTunes
  if ($1 == play) { 
    .set %play $com(itunes,PlayPause,3)
    /track
  }
  else { .echo -a iTunes may not be open. | halt }

  ;Plays the next track
  if ($1 == Next) { .set %next $com(itunes,NextTrack,3)
    /track
  }
  else { .echo -a iTunes may not be open. | halt  }

  ;Plays the previous track
  if ($1 == Previous) {
    .set %Previous $com(itunes,PreviousTrack,3)
    /track
  }
  else { .echo -a iTunes may not be open. | halt  }

  ;Stops the current track
  if ($1 == Stop) { 
    .set %stop $com(itunes,Stop,3)
  }
  else { .echo -a iTunes may not be open. | halt  }
}

I added comments, force of habit. Also, you're more than welcome to remove the spacing.. it works fine as is. Want a shorter version here you go:

alias itunes {
  ;--Opens iTunes--;
  if ($1 == open) { .comopen itunes itunes.application | .echo -a $comerr }

  ;--Activates the play button within iTunes--;
  if ($1 == play) { .set %play $com(itunes,PlayPause,3) | $track }
  else { .echo -a iTunes may not be open. | halt }

  ;--Plays the next track--;
  if ($1 == Next) { .set %next $com(itunes,NextTrack,3) | $track }
  else { .echo -a iTunes may not be open. | halt  }

  ;--Plays the previous track--;
  if ($1 == Previous) { .set %Previous $com(itunes,PreviousTrack,3) | $track }
  else { .echo -a iTunes may not be open. | halt  }

  ;--Stops the current track--;
  if ($1 == Stop) { .set %stop $com(itunes,Stop,3) }
  else { .echo -a iTunes may not be open. | halt  }
}

-.-

 Respond  
The6PuffPack   -  Jan 08, 2012
I honestly don't see how it's useful.. it only mentions what you're listening to and such.. Well excuse me, sir. I said it wasn't that useful. Just leave me alone.
 Respond  
The6PuffPack   -  Jan 08, 2012

and do you have to be so critical?
nagnag :P
and it's not like I'm getting money for it. If I were to, I wouldn't take it. it's only like 50- some lines.

 Respond  
The6PuffPack   -  Jan 08, 2012

{alias itunes {
It had to go there because o- Never mind. This is too stressing.

 Respond  
The6PuffPack   -  Jan 08, 2012

Look at my other one <_<

 Respond  
Sorasyn   -  Jan 08, 2012
{alias itunes {

The extra bracket can and will gum up the entire works.

That's not to mention the outrageous case of brackets you got going.

alias itunes {
  if ($1 == open) {
    .comopen itunes itunes.application
    .echo -a $comerr
  }
}
if ($1 == play) { 
  .set %play $com(itunes,PlayPause,3)
  /track
  if (!%play) {
    .echo -a iTunes may not be open.
  }
}
if ($1 == Next) {
  .set %next $com(itunes,NextTrack,3)
  /track
  if (!%next) {  
    .echo -a iTunes may not be open.
  }
}

Closes the alias leaving a bunch of floating if errors waiting to happen.

Which begs the question: How is this "improved?" Also whom did you steal this off of because it is blatantly clear that you did not 1.) Proofread 2.) Make it yourself, because if you did such clerical errors would be non-existent ESPECIALLY on a snippet that requires indefinite more precision than the average text event.

This is actualy one of my best scripts yet.. Not saying much at this point. :/

 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.