alien_fx_fiend

yt-db-dual-script.ahk

Jul 1st, 2020
255
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. #^y::
  7.     Gui, New, , YT URL Shortener
  8.     Gui, Add, Text, x4 y7, URL:
  9.     Gui, Add, Edit, x32 y5 w400 h18 vURL
  10.     Gui, Add, Button, x435 y4 h20 Default gShort, GO!
  11.     Gui -Resize -SysMenu +ToolWindow +AlwaysOnTop
  12.     Gui, Show, w470
  13.     Return
  14.  
  15. Short:
  16.     Gui, Submit
  17.     Gui, Hide
  18.     Name := URL
  19.     If FoundPos := InStr(Name, "https://www.youtube.com/") {   
  20.     Name := strReplace(Name,"www.youtube.com","youtu.be")
  21.     Name := strReplace(Name,"/watch?v=", "/")
  22.     }
  23.     Else If FoundPos := InStr(Name, "https://www.dropbox.com/") {
  24.     Name := strReplace(Name,"www","dl")
  25.     Name := strReplace(Name,"dropbox", "dropboxusercontent")
  26.     Name := strReplace(Name,"?dl=0","")
  27.     }
  28.     Else {
  29.     MsgBox Error
  30.     }
  31.     GuiControl, , URL, %Name%
  32.     Gui, Show
  33.     Return
  34.    
  35. GuiClose:
  36. GuiEscape:
  37.     Gui, Destroy
Add Comment
Please, Sign In to add comment