' ========= ' SetSkipOn ' ========= ' Version 1.0.0.1 - December 6th 2018 ' Copyright © Steve MacGuire 2012-18 ' http://samsoft.org.uk/iTunes/SetSkipOn ' Please visit http://samsoft.org.uk/iTunes/scripts.asp for updates ' ======= ' Licence ' ======= ' This program is free software: you can redistribute it and/or modify it under the terms ' of the GNU General Public License as published by the Free Software Foundation, either ' version 3 of the License, or (at your option) any later version. ' This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; ' without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ' See the GNU General Public License for more details. ' Please visit http://www.gnu.org/licenses/gpl-3.0-standalone.html to view the GNU GPLv3 licence. ' =========== ' Description ' =========== ' A VBScript to correct the VideoKind property. ' Related scripts: SetSkipOff, SetSkipOn ' ========= ' ChangeLog ' ========= ' Version 1.0.0.1 - Initial version Option Explicit Dim I,K,T,U,Count,iTunes,Title,Track,Tracks Title="Set Skip When Shuffling On" U=0 Set iTunes=CreateObject("iTunes.Application") Set Tracks=iTunes.SelectedTracks If Tracks is Nothing Then MsgBox "Please select some files before calling this script!",VBExclamation,Title Else Count=Tracks.Count For I=Count To 1 Step -1 ' Work backwards in case edit removes item from selection Set Track=Tracks.Item(I) If Track.Kind=1 Then ' Only process file tracks K=Track.ExcludeFromShuffle If K=False Then Track.ExcludeFromShuffle=True U=U+1 End If End If Next T=Count & " file" & Plural(Count,"s were"," was") & " processed of which" & vbCrLf T=T & U & " file" & Plural(U,"s","") & " updated." MsgBox T,0,Title End If ' Return the persistent object representing the track ' Keeps hold of an object that might vanish from a smart playlist as it is updated ' Modified 2012-09-11 Function PersistentObject(T) Dim Ext Ext=LCase(Mid(T.Location,InStrRev(T.Location,"."))) If Instr(".ipa.ipg.m4r",Ext) Then Set PersistentObject=T Else Set PersistentObject=iTunes.LibraryPlaylist.Tracks.ItemByPersistentID(iTunes.ITObjectPersistentIDHigh(T),iTunes.ITObjectPersistentIDLow(T)) End If End Function ' Return relevant string depending on whether value is plural or singular ' Modified 2011-10-04 Function Plural(V,P,S) If V=1 Then Plural=S Else Plural=P End Function