Advertisement
Najeebsk

READ-PLAY-VLC.ahk

May 15th, 2024 (edited)
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;#warn
  2. #NoEnv
  3. #SingleInstance, Force
  4. Process, Priority, , A
  5. SendMode, Input
  6. SetBatchLines, -1
  7. ;#NoTrayIcon
  8. SetWorkingDir %A_ScriptDir%  
  9.  
  10. VLC = %A_programfiles%\VideoLAN\VLC\vlc.exe
  11.  
  12. Gui, Add, Button, x10 y10 w100 h30 gBrowse, Browse
  13. Gui, Add, Edit, x10 y50 w900 h560 vSelectedLine, Selected Line will appear here
  14. Gui, Add, Edit, x10 y620 w400 h26 vSearchText, Type here to search
  15. Gui, Add, Button, x420 y620 w100 h30 gSearch, Search
  16. Gui, Add, Button, x530 y620 w100 h30 gPlay, Play
  17. Gui, Add, Button, x640 y620 w100 h30 gExit, Exit
  18.  
  19. Gui, Show, w920 h660, AutoHotkey GUI
  20.  
  21. return
  22.  
  23. Browse:
  24. FileSelectFile, SelectedFile, 1, , Select a text file, Text files (*.txt)
  25. if (ErrorLevel)
  26.     return
  27. FileRead, FileContent, %SelectedFile%
  28. GuiControl,, SelectedLine, %FileContent%
  29. return
  30.  
  31. Search:
  32. GuiControlGet, searchText, , SearchText
  33. GuiControlGet, fileContent, , SelectedLine
  34. StartPosition := RegExMatch(fileContent, searchText, Position)
  35. if (StartPosition > 0)
  36. {
  37.     SelectedText := SubStr(fileContent, StartPosition)
  38.     GuiControl,, SelectedLine, %SelectedText%
  39. }
  40. else
  41. {
  42.     MsgBox, No match found!
  43. }
  44. return
  45.  
  46. Play:
  47. ControlGet, outputvar, Selected,,Edit1,
  48. Run, "%VLC%" --fullscreen --playlist-enqueue "%outputvar%"
  49. return
  50.  
  51. Exit:
  52. GuiClose:
  53. ExitApp
  54. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement