Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;#warn
- #NoEnv
- #SingleInstance, Force
- Process, Priority, , A
- SendMode, Input
- SetBatchLines, -1
- ;#NoTrayIcon
- SetWorkingDir %A_ScriptDir%
- VLC = %A_programfiles%\VideoLAN\VLC\vlc.exe
- Gui, Add, Edit, w900 h600 vPlaylist
- ; Set button layout to horizontal
- Gui, Add, Button, x5 y620 w100 gLoadPlaylist, Load Playlist
- Gui, Add, Button, x+5 y620 w100 gSaveAllURLs, Save All URLs
- Gui, Add, Button, x+5 y620 w100 gOpenInVLC, Open VLC
- Gui, Add, Button, x+5 y620 w100 gExitScript, Exit
- Gui, Show, , Playlist Viewer
- return
- LoadPlaylist:
- FileSelectFile, PlaylistFile, 3, , Select a playlist file (*.m3u;*.m3u8)
- if (ErrorLevel || PlaylistFile = "")
- {
- MsgBox, 16, Error, Unable to load the playlist file.
- return
- }
- FileRead, PlaylistContent, %PlaylistFile%
- if ErrorLevel
- {
- MsgBox, 16, Error, Unable to read the contents of the playlist file.
- return
- }
- GuiControl,, Playlist, ; Clear existing playlist
- URLList := "" ; Initialize an empty string to hold the URLs
- Loop, Parse, PlaylistContent, `n
- {
- if (RegExMatch(A_LoopField, "^(?!#EXTM3U|#EXTINF:-1|#.*\.(png|jpg|bmp)).*$", URL))
- {
- URLList .= URL "`n" ; Append the URL to the list
- }
- }
- GuiControl,, Playlist, %URLList% ; Display the list of URLs
- return
- ExitScript:
- ExitApp
- return
- OpenInVLC:
- GuiControlGet, PlaylistContent,, Playlist
- Run, %VLC% ;"%PlaylistContent%"
- Sleep, 5000 ; 5-second delay
- Send, ^v
- return
- SaveAllURLs:
- GuiControlGet, PlaylistContent,, Playlist
- FileDelete, Playlist.txt
- FileAppend, %PlaylistContent%, Playlist.txt
- MsgBox, Playlist URLs saved to Playlist.txt
- return
- GuiContextMenu(playlist) {
- Menu, ContextMenu, Add, Save Selected URLs, SaveSelectedURLs
- Menu, ContextMenu, Show
- return
- }
- SaveSelectedURLs:
- GuiControlGet, SelectedItem,, Playlist
- FileAppend, %SelectedItem%, Playlist.txt
- MsgBox, Selected URL saved to Playlist.txt
- return
Add Comment
Please, Sign In to add comment