; PureBasic Visual Designer v3.95 build 1485 (PB4Code) IncludeFile "iTunesScriptStarterForms.pb" Procedure.b FileSystemStartIncludedFile(sPath.s, *lMemory.l, lLength.l) Protected lFileId.l = CreateFile(#PB_Any, sPath) If lFileId WriteData(lFileId, *lMemory, lLength) CloseFile(lFileId) RunProgram('wscript.exe', sPath) ProcedureReturn #True EndIf ProcedureReturn #False EndProcedure Open_Window_0() Repeat ; Start of the event loop Event = WaitWindowEvent() ; This line waits until an event is received from Windows WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures GadgetID = EventGadget() ; Is it a gadget event? EventType = EventType() ; The event type ;You can place code here, and use the result as parameters for the procedures If Event = #PB_Event_Gadget If GadgetID = #Button_AlbumPlaylist FileSystenStartIncludedFile("test.js", ?CreateAlbumPlaylists, ?RemoveDeadTracks - ?CreateAlbumPlaylists) ElseIf GadgetID = #Button_DeadTracks ElseIf GadgetID = #Button_DoubleTracks ElseIf GadgetID = #Button_RemovePlaylists EndIf EndIf Until Event = #PB_Event_CloseWindow ; End of the event loop End ; DataSection CreateAlbumPlaylists: IncludeBinary "E:\Programme\iTunes Scripts\CreateAlbumPlaylists.js" RemoveDeadTracks: IncludeBinary "E:\Programme\iTunes Scripts\RemoveDeadTracks.js" RemoveDoubleTracks: IncludeBinary "E:\Programme\iTunes Scripts\RemoveDoubleTracks.js" RemoveUserPlaylists: IncludeBinary "E:\Programme\iTunes Scripts\RemoveUserPlaylists.js" EndDataSection ;