|
|
Line 1: |
Line 1: |
| '
| | For iCounter = 0 to objSongList.count - 1 '[[SDBSongList|SongLists]] |
| ' MediaMonkey Script
| | Set objSongData = objSongList.Item(iCounter} |
| '
| | {{{3|-}}}{{{2|-}}} = objSongData.{{{2|-}}}{{#ifeq:{{{3|-}}}|Object|.Member}} |
| ' NAME: WikiSample.vbs
| | SDB.MessageBox "Value = '" & {{{8|-}}} & "'", mtError, Array(mbOK) '[[ISDBApplication::MessageBox|SDB.MessageBox]] |
| '
| | Next |
| ' Template Author: MoDementia
| | ' objSongData.{{{2|-}}}{{#ifeq:{{{3|-}}}|Object|.Member}} = {{{3|-}}}New{{{2|-}}} 'Commented Out For Safety |
| ' Generated by MMWiki page {{PAGENAME}}
| |
| ' Time, DATE : {{CURRENTTIME}}, {{CURRENTDAY2}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}}
| |
| '
| |
| 'Sample of Scripting Code for inclusion into MMWiki pages
| |
| 'A working script to show database results using various selection methods
| |
| '
| |
| 'MediaMonkey\Scripts\Scripts.in entry
| |
| '
| |
| '[WikiSample] '[[Introduction_to_scripting#Format_of_the_Scripts.ini_file|Format of the Scripts.ini file]]
| |
| 'Filename=WikiSample.vbs
| |
| 'Procname=WikiSample
| |
| 'Order=99
| |
| 'DisplayName=WikiSample
| |
| 'Description=Displays the raw database value of the MMWikipage item
| |
| 'Language=VBScript
| |
| 'ScriptType=0
| |
|
| |
|
| |
| Sub WikiSample
| |
|
| |
| Dim SelectMethod, SampleID, {{{3|-}}}New{{{2|-}}}
| |
| {{#ifeq:{{{3|-}}}|Object| | Dim SQLString 'SelectMethod 3}}
| |
| Dim objSongList 'SelectMethod 2
| |
|
| |
| SelectMethod = 1
| |
| ' SelectMethod NowPlaying = 1
| |
| ' SelectMethod UseSQLQuery = 2
| |
| {{#ifeq:{{{3|-}}}|Object| | ' SelectMethod UseSQL = 3}}
| |
| ' SelectMethod SelectedSongs = 4
| |
|
| |
| SampleID = 13123
| |
| {{{3|-}}}New{{{2|-}}} = "Mamma Mia"
| |
| Set objSongList = SDB.NewSongList 'SelectMethod 2 and 3 [[ISDBApplication::NewSongList|SDB.NewSongList]]
| |
|
| |
| Select Case SelectMethod
| |
| Case 1
| |
| Set objSongData = SDB.Player.CurrentSong '[[ISDBPlayer::CurrentSong|SDB.Player.CurrentSong]]
| |
| Case 2
| |
| Set objSongListiterator = SDB.Database.QuerySongs("AND Songs.ID=" & SampleID) '[[ISDBDatabase::QuerySongs|SDB.Database.QuerySongs]]
| |
| {{#ifeq:{{{3|-}}}|Object| | Case 3}}
| |
| {{#ifeq:{{{3|-}}}|Object| | SQLString = "SELECT {{{5|-}}} FROM {{{4|-}}} WHERE {{{4|-}}}.ID = " & SampleID}}
| |
| {{#ifeq:{{{3|-}}}|Object| | Set objSongListiterator = SDB.Database.OpenSQL(SQLString) '[[ISDBDatabase::OpenSQL|SDB.Database.OpenSQL]]}}
| |
| Case 4
| |
| Set objSongList = SDB.SelectedSongList '[[ISDBApplication::SelectedSongList|SDB.SelectedSongList]]
| |
| ' Set objSongList = SDB.CurrentSongList '[[ISDBApplication::CurrentSongList|SDB.CurrentSongList]]
| |
| ' Set objSongList = SDB.AllVisibleSongList '[[ISDBApplication::AllVisibleSongList|SDB.AllVisibleSongList]]
| |
| Case Else
| |
| SDB.MessageBox "Incorrect Select Method ", mtError, Array(mbOK) '[[ISDBApplication::MessageBox|SDB.MessageBox]]
| |
| Exit Sub
| |
| End Select
| |
|
| |
| For iCounter = 0 to objSongList.count - 1 'SelectMethod 4 [[SDBSongList|SongLists]] | |
| While Not objSongListiterator.EOF 'SelectMethod 2 and 3 [[SDBDBIterator|Iterator]]
| |
| Set objSongData = objSongListiterator.Item 'SelectMethod 2
| |
| objSongList.Add(objSongData) 'SelectMethod 2
| |
| Set objSongData = objSongList.Item(iCounter) 'SelectMethod 4 | |
| {{{3|-}}}{{{2|-}}} = objSongData.{{{2|-}}}{{#ifeq:{{{3|-}}}|Object|.Member}} 'SelectMethod 1, 2 and 4 | |
| SDB.MessageBox "Value = '" & {{{3|-}}}{{{2|-}}} & "'", mtError, Array(mbOK) 'SelectMethod 4 (2 and 3) | |
| {{#ifeq:{{{3|-}}}|Object| | {{{3|-}}}{{{2|-}}} = objSongListiterator.StringByIndex(0) 'SelectMethod 3}}
| |
| objSongListiterator.Next 'SelectMethod 2 and 3
| |
| Wend 'SelectMethod 2 and 3
| |
| Next 'SelectMethod 4 | |
| Set objSongListiterator=Nothing 'SelectMethod 2 and 3
| |
|
| |
| SDB.MessageBox "Value = '" & {{{3|-}}}{{{2|-}}} & "'", mtError, Array(mbOK)
| |
|
| |
| ' objSongData.{{{2|-}}}{{#ifeq:{{{3|-}}}|Object|.Member}} = {{{3|-}}}New{{{2|-}}} 'Commented Out For Safety 'SelectMethod 1, 2 and 4 | |
| ' objSonglist.UpdateAll 'Commented Out For Safety '[[SDBSongData|UpdateAll]] | | ' objSonglist.UpdateAll 'Commented Out For Safety '[[SDBSongData|UpdateAll]] |
| 'SelectMethod 1, 2 and 4 Updates db and writes tags (if checked in options) | | Updates db and writes tags (if checked in options) |
| End Sub<noinclude>[[Category:Template]]</noinclude> | | End Sub<noinclude>[[Category:Template]]</noinclude> |