Template:Example Code: Difference between revisions
Jump to navigation
Jump to search
MoDementia (talk | contribs) No edit summary |
MoDementia (talk | contribs) No edit summary |
||
Line 26: | Line 26: | ||
Sub WikiSample | Sub WikiSample | ||
Dim SelectMethod, WaterlooSongID, {{{3|-}}} New (((2}}} | Dim SelectMethod, WaterlooSongID, {{{3|-}}}New(((2|-}}} | ||
Dim SQLString 'SelectMethod 3 | Dim SQLString 'SelectMethod 3 | ||
Dim SongList 'SelectMethod 2 and 3 | Dim SongList 'SelectMethod 2 and 3 | ||
Line 37: | Line 37: | ||
SampleID = 13123 | SampleID = 13123 | ||
(((3}}}New(((2}}} = "Mamma Mia" | (((3|-}}}New(((2|-}}} = "Mamma Mia" | ||
Set objSongList = SDB.NewSongList 'SelectMethod 2 and 3 | Set objSongList = SDB.NewSongList 'SelectMethod 2 and 3 | ||
Line 46: | Line 46: | ||
Set objSongListiterator = SDB.Database.QuerySongs("AND Songs.ID=" & SampleID) | Set objSongListiterator = SDB.Database.QuerySongs("AND Songs.ID=" & SampleID) | ||
Case 3 | Case 3 | ||
SQLString = "SELECT (((5}}} FROM (((4}}} WHERE (((4}}}.ID = " & SampleID | SQLString = "SELECT (((5|-}}} FROM (((4|}}} WHERE (((4|}}}.ID = " & SampleID | ||
Set objSongListiterator = SDB.Database.OpenSQL(SQLString) | Set objSongListiterator = SDB.Database.OpenSQL(SQLString) | ||
Case 4 | Case 4 | ||
Line 62: | Line 62: | ||
objSongList.Add(objSongData) 'SelectMethod 2 | objSongList.Add(objSongData) 'SelectMethod 2 | ||
Set objSongData = objSongList.Item(iCounter) 'SelectMethod 4 | Set objSongData = objSongList.Item(iCounter) 'SelectMethod 4 | ||
(((3}}}(((2}}} = objSongData.{{{2}}} 'SelectMethod 1, 2 and 4 | (((3|-}}}(((2|-}}} = objSongData.{{{2|-}}} 'SelectMethod 1, 2 and 4 | ||
SDB.MessageBox "Value = '" & (((3}}}(((2}}} & "'", mtError, Array(mbOK) 'SelectMethod 4 (2 and 3) | SDB.MessageBox "Value = '" & (((3|-}}}(((2|-}}} & "'", mtError, Array(mbOK) 'SelectMethod 4 (2 and 3) | ||
(((3}}}(((2}}} = objSongListiterator.StringByIndex(0) 'SelectMethod 2 | (((3|-}}}(((2|-}}} = objSongListiterator.StringByIndex(0) 'SelectMethod 2 | ||
objSongListiterator.Next 'SelectMethod 2 and 3 | objSongListiterator.Next 'SelectMethod 2 and 3 | ||
Wend 'SelectMethod 2 and 3 | Wend 'SelectMethod 2 and 3 | ||
Line 70: | Line 70: | ||
Set objSongListiterator=Nothing 'SelectMethod 2 and 3 | Set objSongListiterator=Nothing 'SelectMethod 2 and 3 | ||
SDB.MessageBox "Value = '" & (((3}}}(((2}}} & "'", mtError, Array(mbOK) | SDB.MessageBox "Value = '" & (((3|-}}}(((2|-}}} & "'", mtError, Array(mbOK) | ||
' objSongData.(((2}}} = (((3}}}New(((2}}} 'Commented Out For Safety 'SelectMethod 1, 2 and 4 | ' objSongData.(((2|-}}} = (((3|-}}}New(((2|-}}} 'Commented Out For Safety 'SelectMethod 1, 2 and 4 | ||
' Songlist.UpdateAll 'Commented Out For Safety | ' Songlist.UpdateAll 'Commented Out For Safety | ||
'SelectMethod 1, 2 and 4 Updates db and writes tags (if checked in options) | 'SelectMethod 1, 2 and 4 Updates db and writes tags (if checked in options) | ||
End Sub | End Sub |
Revision as of 22:38, 7 April 2008
{{{1}}} {{{2}}} {{{3}}} {{{4}}} {{{5}}}
' ' MediaMonkey Script ' ' NAME: WikiSample.vbs ' ' Template Author: MoDementia ' Generated by MMWiki page Example Code ' DATE : 03:51, 7 April 2008 (EDT) ' '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] '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, WaterlooSongID, -New(((2|-}}} Dim SQLString 'SelectMethod 3 Dim SongList 'SelectMethod 2 and 3 SelectMethod = 1 ' SelectMethod NowPlaying = 1 ' SelectMethod UseSQLQuery = 2 ' SelectMethod UseSQL = 3 ' SelectMethod SelectedSongs = 4 SampleID = 13123 (((3|-}}}New(((2|-}}} = "Mamma Mia" Set objSongList = SDB.NewSongList 'SelectMethod 2 and 3 Select Case SelectMethod Case 1 Set objSongData = SDB.Player.CurrentSong Case 2 Set objSongListiterator = SDB.Database.QuerySongs("AND Songs.ID=" & SampleID) Case 3 SQLString = "SELECT (((5|-}}} FROM (((4|}}} WHERE (((4|}}}.ID = " & SampleID Set objSongListiterator = SDB.Database.OpenSQL(SQLString) Case 4 Set objSongList = SDB.SelectedSongList ' Set objSongList = SDB.CurrentSongList ' Set objSongList = SDB.AllVisibleSongList Case Else SDB.MessageBox "Incorrect Select Method ", mtError, Array(mbOK) Exit Sub End Select For iCounter = 0 to objSongList.count - 1 'SelectMethod 4 While Not objSongListiterator.EOF 'SelectMethod 2 and 3 Set objSongData = objSongListiterator.Item 'SelectMethod 2 objSongList.Add(objSongData) 'SelectMethod 2 Set objSongData = objSongList.Item(iCounter) 'SelectMethod 4 (((3|-}}}(((2|-}}} = objSongData.- 'SelectMethod 1, 2 and 4 SDB.MessageBox "Value = '" & (((3|-}}}(((2|-}}} & "'", mtError, Array(mbOK) 'SelectMethod 4 (2 and 3) (((3|-}}}(((2|-}}} = objSongListiterator.StringByIndex(0) 'SelectMethod 2 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|-}}} = (((3|-}}}New(((2|-}}} 'Commented Out For Safety 'SelectMethod 1, 2 and 4 ' Songlist.UpdateAll 'Commented Out For Safety 'SelectMethod 1, 2 and 4 Updates db and writes tags (if checked in options) End Sub