Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance force
- #NoEnv
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #Persistent
- global Name
- global EditContent
- global YT_URL
- #^y::
- Label_a:
- Gui, Submit , NoHide
- Gui, Destroy
- GoSub, GUI
- MsgBox, This message box will show because the variable "vButton" was destroyed along with the Gui.
- Return
- GUI:
- InputBox, YT_URL, YouTube to youtu.be Shortened, Enter a YouTube Long URL Here:
- ;Gui, Submit , NoHide
- global Name := % YT_URL
- Name := strReplace(Name,"www.youtube.com","youtu.be")
- Name := strReplace(Name,"/watch?v=", "/")
- global EditContent = % Name
- GoSub, GUI2
- Return
- GUI2:
- ;Gui, Hide
- Gui, MyGui:Add, Edit, r1 vBox1 w630, %EditContent%
- ;GuiControl,, Box1, %EditContent% ; Put the text into the control.
- Gui, MyGui:Show, w650 h100, Box1
- EditContent := ""
- Name := ""
- YT_URL := ""
- ;cnt :=0
- ButtonOK:
- GuiClose:
- GuiEscape:
- Gui, Submit ; Save the input from the user to each control's associated variable.
- GuiControl,, Box1 ; Clear the Edit control.
- Return
- /* 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