Advertisement
alien_fx_fiend

YouTube Links Converter Script (Multi-GUI Defunct)

Jun 26th, 2020
3,384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance force
  2. #NoEnv
  3. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  4. #Persistent
  5.  
  6. global Name
  7. global EditContent
  8. global YT_URL
  9.  
  10. #^y::
  11. Label_a:
  12. Gui, Submit , NoHide
  13. Gui, Destroy
  14. GoSub, GUI
  15. MsgBox, This message box will show because the variable "vButton" was destroyed along with the Gui.
  16. Return
  17.  
  18. GUI:
  19. InputBox, YT_URL, YouTube to youtu.be Shortened, Enter a YouTube Long URL Here:
  20. ;Gui, Submit , NoHide
  21. global Name := % YT_URL
  22. Name := strReplace(Name,"www.youtube.com","youtu.be")
  23. Name := strReplace(Name,"/watch?v=", "/")
  24. global EditContent = % Name
  25. GoSub, GUI2
  26. Return
  27.  
  28. GUI2:
  29. ;Gui, Hide
  30. Gui, MyGui:Add, Edit, r1 vBox1 w630, %EditContent%
  31. ;GuiControl,, Box1, %EditContent%  ; Put the text into the control.
  32. Gui, MyGui:Show, w650 h100, Box1
  33. EditContent := ""
  34. Name := ""
  35. YT_URL := ""
  36. ;cnt :=0
  37. ButtonOK:
  38. GuiClose:
  39. GuiEscape:
  40. Gui, Submit  ; Save the input from the user to each control's associated variable.
  41. GuiControl,, Box1  ; Clear the Edit control.
  42. Return
  43.  
  44. /* Error: The same variable cannot be used for more than one control. Specifically vBox1 w630 line 051: Gui, MyGui:Add, Edit, r1 vBox1 w630, %EditContent% The current thread will exit. Sample links to test it with: https://www.youtube.com/watch?v=FMR8EYpQj6I https://www.youtube.com/watch?v=GzQLTByH1S0 */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement