Genre Shortcut Keys

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Magic 8 Ball
Posts: 6
Joined: Sun May 15, 2005 11:17 am

Genre Shortcut Keys

Post by Magic 8 Ball »

Hey, I have no knowledge of scripting at all. But im a pretty good learner. But I would love if there was a scrpt or code so that I could use my Numeric Keypad, to set the Genre. Kinda like this.

#1 = Rock
#2 = Rap
#3 = Dance
#4 = Country
#5 = Reggae
#6 = Hip-Hop
#7 = Alternative
#8 = Comedy
#9 = Sountrack

It would be nice if all I had to do is press one of those numbers on my Numeric Keypad, but it would be ok if I had to press <ctrl><1> to do it also. As long as it works. And I cant use the numbers on top of the keyboard because I already have a script that Im using for those.

Any advice on how to make the scrpit and how to learn how to make scripts? Or even better, anyone out there that would like to make it out there for me, in return I will give you a very big THANK YOU.
PEACE, LOVE, AND HAPPINESS.
And sometimes war.
Peke
Posts: 17446
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

See MMs developers page. You will find all relevant informations needed for scripting.

The Script should be easy to make only few lines ot Code.

If you need help do not hasiate to ask.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Magic 8 Ball
Posts: 6
Joined: Sun May 15, 2005 11:17 am

Post by Magic 8 Ball »

Im still hopeless, there arent any real good tutorials on how to make scripts, I am completly clueless of scripts. I have naever programmed or scrpited ever. Im pretty good with HTML, but all this other stuff is really new. Are there any other places I can look to find out how to make this kind of script?
PEACE, LOVE, AND HAPPINESS.
And sometimes war.
Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo »

So, if I understand correctly, you want to assign the genre associated to the shortcut to the currently selected track(s)?

I'll try to help you out with some code when I have a little time.
Magic 8 Ball
Posts: 6
Joined: Sun May 15, 2005 11:17 am

Post by Magic 8 Ball »

That is right on the money. I cant thank you enough for doing this. your guys are very nice and helpfull people, please stay that way. Oh and if you are actually going to make this script for me, pretty please assign these keys, to these genres.

#1 = Rock
#2 = Rap
#3 = Dance
#4 = Country
#5 = Reggae
#6 = Hip-Hop
#7 = Alternative
#8 = Comedy
#9 = Sountrack

I wish I could give you something in return, but I really cant. Thank you so so so much.
PEACE, LOVE, AND HAPPINESS.
And sometimes war.
Peke
Posts: 17446
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

Ok, here it is :D,
Save this to Mediamonkey/Scripts/Auto Folder Name it "Predefined Genre.vbs"

Code: Select all

 Updated Code is sent in newer Posts
Edit "Str_Genre? =" Lines for your needs.

Restart MM and enjoy. You'll find "Change Genre" under Edit Menu.

Note: This Script do not update Tags just MM library.
Last edited by Peke on Wed May 18, 2005 3:58 pm, edited 1 time in total.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Magic 8 Ball
Posts: 6
Joined: Sun May 15, 2005 11:17 am

Post by Magic 8 Ball »

Thank you sooooooo much, it works like a charm, you guys rock.
PEACE, LOVE, AND HAPPINESS.
And sometimes war.
Magic 8 Ball
Posts: 6
Joined: Sun May 15, 2005 11:17 am

Post by Magic 8 Ball »

Wait, is there any way for me to change the numbers to my Numeric Keypad numbers, cause now I cant rate my songs by using the ctrl+alt+1 ect.. keys. But great script.
PEACE, LOVE, AND HAPPINESS.
And sometimes war.
Peke
Posts: 17446
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

Will Look At it.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
Posts: 17446
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

Num Keys Can't be used in ShorCuts But I made some Changes so user can easy change behavior of ShortCut Keys.

Defaults Are CTRL+ALT+ keys.

Here is Code:

Code: Select all

'==========================================================================
'
' MediaMonkey Script
'
' NAME: Predefined Genre Script v1.0
'
' AUTHOR: Peke
' DATE  : 18.05.2005
'
' INSTALL: Change Defaults in "Variable Configuration" Section of this file
'
'==========================================================================
'==========================================================================
' Variable Definition (Do Not Change)
'==========================================================================

' Genre Variables
Dim Str_Genre1, Str_Genre2, Str_Genre3, Str_Genre4, Str_Genre5, Str_Genre6, Str_Genre7, Str_Genre8, Str_Genre9, Str_Genre10 

' Hotkey Variables
Dim Use_Shift, Use_Ctrl, Use_Alt

'==========================================================================
' Variable Configuration
'==========================================================================
'Set Value to TRUE/FALSE if you want to it use in HotKey
Use_Shift = FALSE
Use_Ctrl  = TRUE
Use_Alt   = TRUE

'Change genres According to your needs
Str_Genre1  = "Rock"
Str_Genre2  = "Rap"
Str_Genre3  = "Dance"
Str_Genre4  = "Country"
Str_Genre5  = "Reggae"
Str_Genre6  = "Hip-Hop"
Str_Genre7  = "Alternative"
Str_Genre8  = "Comedy"
Str_Genre9  = "Sountrack"
Str_Genre10 = "Pop"
'===< CONFIGUTARTION ENDED >===============================================

'==========================================================================
' MediaMonkey On Start Procedure
'==========================================================================
Sub OnStartup

  Dim HotKeyRing
  HotKeyRing = ""
  If Use_Shift Then
  	HotKeyRing = HotKeyRing&"Shift+"
  End if
  If Use_Ctrl Then
  	HotKeyRing = HotKeyRing&"Ctrl+"
  End if
  If Use_Alt Then
  	HotKeyRing = HotKeyRing&"Alt+"
  End if
 
  Dim EGenre
  Set EGenre = SDB.UI.addMenuItemSub(SDB.UI.Menu_Edit,0,0)
  EGenre.caption = "Change Genre"
  EGenre.IconIndex = 58
  EGenre.useScript = Script.ScriptPath
  
  Dim Genre1
  Set Genre1 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre1.Caption = "#1 "&Str_Genre1
  Genre1.OnClickFunc = "PredefinedGenre"
  Genre1.UseScript = Script.ScriptPath
  Genre1.IconIndex = 18
  Genre1.ShortCut = HotKeyRing&"1"
  
  Dim Genre2
  Set Genre2 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre2.Caption = "#2 "&Str_Genre2
  Genre2.OnClickFunc = "PredefinedGenre"
  Genre2.UseScript = Script.ScriptPath
  Genre2.IconIndex = 18
  Genre2.ShortCut = HotKeyRing&"2"
  
  Dim Genre3
  Set Genre3 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre3.Caption = "#3 "&Str_Genre3
  Genre3.OnClickFunc = "PredefinedGenre"
  Genre3.UseScript = Script.ScriptPath
  Genre3.IconIndex = 18
  Genre3.ShortCut = HotKeyRing&"3"

  Dim Genre4
  Set Genre4 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre4.Caption = "#4 "&Str_Genre4
  Genre4.OnClickFunc = "PredefinedGenre"
  Genre4.UseScript = Script.ScriptPath
  Genre4.IconIndex = 18
  Genre4.ShortCut = HotKeyRing&"4"

  Dim Genre5
  Set Genre5 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre5.Caption = "#5 "&Str_Genre5
  Genre5.OnClickFunc = "PredefinedGenre"
  Genre5.UseScript = Script.ScriptPath
  Genre5.IconIndex = 18
  Genre5.ShortCut = HotKeyRing&"5"

  Dim Genre6
  Set Genre6 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre6.Caption = "#6 "&Str_Genre6
  Genre6.OnClickFunc = "PredefinedGenre"
  Genre6.UseScript = Script.ScriptPath
  Genre6.IconIndex = 18
  Genre6.ShortCut = HotKeyRing&"6"

  Dim Genre7
  Set Genre7 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre7.Caption = "#7 "&Str_Genre7
  Genre7.OnClickFunc = "PredefinedGenre"
  Genre7.UseScript = Script.ScriptPath
  Genre7.IconIndex = 18
  Genre7.ShortCut = HotKeyRing&"7"

  Dim Genre8
  Set Genre8 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre8.Caption = "#8 "&Str_Genre8
  Genre8.OnClickFunc = "PredefinedGenre"
  Genre8.UseScript = Script.ScriptPath
  Genre8.IconIndex = 18
  Genre8.ShortCut = HotKeyRing&"8"

  Dim Genre9
  Set Genre9 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre9.Caption = "#9 "&Str_Genre9
  Genre9.OnClickFunc = "PredefinedGenre(9)"
  Genre9.UseScript = Script.ScriptPath
  Genre9.IconIndex = 18
  Genre9.ShortCut = HotKeyRing&"9"

  Dim Genre0
  Set Genre0 = SDB.UI.AddMenuItem(EGenre,0,0)
  Genre0.Caption = "#10 "&Str_Genre10
  Genre0.OnClickFunc = "PredefinedGenre"
  Genre0.UseScript = Script.ScriptPath
  Genre0.IconIndex = 18
  Genre0.ShortCut = HotKeyRing&"0"
  
End Sub

Sub EditGenre(Str_Genre)
  Dim list, itm, i
  If SDB.SelectedSongList.count = 0 Then
    Result = SDB.MessageBox( "No tracks Selected!", mtError, Array(mbOk))
    Exit Sub
  End If
  Set list = SDB.SelectedSongList
  For i=0 To list.count-1
    Set itm = list.Item(i)
    itm.Genre = Str_Genre
    itm.UpdateDB
  Next

End Sub

Sub PredefinedGenre(Item)
   If Left(Item.Caption,3) = "#10" Then
     EditGenre(Right(Item.Caption,Len(Item.Caption)-4))
   Else
     EditGenre(Right(Item.Caption,Len(Item.Caption)-3))
   End If
End Sub
Enjoy!
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
xman

Post by xman »

Great :)
Is it possible to modify this script to be able to rate the songs by Hatkeys?
baker

Post by baker »

Xman, open the script in your text editor of choice and do a find/replace with "genre"/"rating". Then, replace the genre names with the rating (1-100) you want to assign to that key. This also works for Year and probably any other parameter in the library.

Kudos for a great script making MM even easier to use.
Peke
Posts: 17446
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

THX, you are right as same structure can be use for what ever you want.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
rk
Posts: 104
Joined: Mon Jul 25, 2005 2:18 am
Location: Germany

Post by rk »

Hi folks,
Is it possible to modify this script to be able to rate the songs by Hatkeys?
I rewrote the script regarding rating for my own needs. It only allows for the full stars, but can easily be adjusted to also support half stars and 'unrated'.

Here it is for whoever might find it useful:

Code: Select all

 ... see below ...
Last edited by rk on Thu Aug 25, 2005 2:58 am, edited 1 time in total.
Peke
Posts: 17446
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

Clean, nice, Very good and usable

Sorry, but I changed Header as I see it better this way. It is your script mine is just an idea/example. I do not wanna take credits for your work just a little note if I can? :roll: 8)

Code: Select all

'==========================================================================
'
' MediaMonkey Script
'
' NAME: Predefined RATING Script v1.0
'
' AUTHOR: Ralf 
' DATE  : 24.08.2005
' 
' NOTE: Idea taken from Pekes "Predefined Genre Script v1.0"
'
' INSTALL:
' * Change Defaults in "Variable Configuration" Section of this file
' * Copy to Scripts\Auto directory
'
'==========================================================================

'==========================================================================
' Variable Definition (Do Not Change)
'==========================================================================
' Hotkey Variables
Dim Use_Shift, Use_Ctrl, Use_Alt

'==========================================================================
' Variable Configuration
'==========================================================================
'Set Value to TRUE/FALSE if you want to it use in HotKey
Use_Shift = FALSE 'TRUE
Use_Ctrl  = FALSE 'TRUE
Use_Alt   = FALSE 'TRUE

MenuIcon = 64

'==========================================================================
' MediaMonkey On Start Procedure
'==========================================================================
Sub OnStartup
'--------------
' Build the hotkey modifier
'--------------
  Dim HotKeyRing
  HotKeyRing = ""
  If Use_Shift Then
     HotKeyRing = HotKeyRing&"Shift+"
  End if
  If Use_Ctrl Then
     HotKeyRing = HotKeyRing&"Ctrl+"
  End if
  If Use_Alt Then
     HotKeyRing = HotKeyRing&"Alt+"
  End if

'----------------
' Create a new menu entry
'----------------
' first we make a separator
  SDB.UI.AddMenuItemSep SDB.UI.Menu_Edit, 0, 0

  Dim RatingMenu
  Set RatingMenu = SDB.UI.addMenuItemSub(SDB.UI.Menu_Edit,0,0)
  RatingMenu.caption = "Change Rating"
  RatingMenu.IconIndex = MenuIcon
  RatingMenu.useScript = Script.ScriptPath

'----------------
' Create the sub menus
'----------------
  Dim RatingSubmenu(6)
  Dim i
 
  for i = 0 to 5
    Set RatingSubmenu(i) = SDB.UI.AddMenuItem(RatingMenu,0,0)

    RatingSubmenu(i).Caption = i & " Star"
    RatingSubmenu(i).OnClickFunc = "PredefinedRating"
    RatingSubmenu(i).UseScript = Script.ScriptPath
    RatingSubmenu(i).IconIndex = MenuIcon
    RatingSubmenu(i).ShortCut = HotKeyRing&i
  Next
 
End Sub


Sub EditRating(i_rating)
  Dim songlist, song, i

  If SDB.SelectedSongList.count = 0 Then
    Result = SDB.MessageBox( "No tracks Selected!", mtError, Array(mbOk))
    Exit Sub
  End If

  Set songlist = SDB.SelectedSongList
  For i=0 To songlist.count-1
    Set song = songlist.Item(i)
    song.Rating = i_rating
    song.UpdateDB
  Next

End Sub


Sub PredefinedRating(Item)
'  Rating varies from 0 (= 0 stars) to 100 (= 5 stars)
'  So we multiply caption (= 0...5) with 20
   EditRating(Left(Item.Caption,1)*20)
End Sub 
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Post Reply