Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Aaron's YouTube Player Creator


  • Please log in to reply
17 replies to this topic
nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
EnterWidth:
Loop ; Continue until they do it right
{
   InvalidNumber := false
   InputBox, w, YouTube Video Player Creator, Enter the width`, stupid,, 350, 200
   If ErrorLevel ; Pressed cancel
      ExitApp
   If w is not number ; If User enters anything but numbers
      InvalidNumber := true
   If (InvalidNumber || w > 1920 || w < 400)
      MsgBox, You entered an invalid number.`nPlease try again
   Else Break
}
Fixed :wink:
(the inputbox text is there because it fits in one screen-line)

aaronbewza
  • Members
  • 466 posts
  • Last active: Feb 05 2013 08:40 AM
  • Joined: 20 Feb 2011
oh that's nasty beautiful. I've got this now:
EnterWidth:
Loop ; Goes through all the 'If's until number is entered and is within the specified range
  {
    InvalidNumber := false
    InputBox, w, YouTube Video Player Creator, blaaa bla,, 350, 200
    If ErrorLevel ; If User presses cancel
      ExitApp
    If w is not number ; If User enters anything but numbers
      InvalidNumber := true
    If (InvalidNumber || w > 1920 || w < 400)
      MsgBox, You entered an invalid number.`nPlease try again
    Else Break
  }

...AND the RegExReplace is working... with this:
BuildHTML:
InputBox, PlayerName, YouTube Video Player Creator, more blaaa lol,, 450, 200
  If ErrorLevel = 1
    ExitApp
WeirdCharacters = [\\/:*?"<>|`%]
PlayerName := RegExReplace(PlayerName, WeirdCharacters)

Thank you both Guest and Nimda!

There seem to be quite a few instances of the faulty old way where it stacks on itself. I understand now how a subroutine stacks when it keeps subroutining the subroutine that calls the subroutine. Makes sense for how silly that sounds.

I will update the rest of the script with the Loop, and post again when it is done, tomorrow. This requires a version number change :) I like those.

aaronbewza
  • Members
  • 466 posts
  • Last active: Feb 05 2013 08:40 AM
  • Joined: 20 Feb 2011
UPDATED to version 0.9.2.0 (download links updated in first post)

- used proper Loop instead of incorrect applications of GoSub (thanks nimda!)
- RegExReplace now working 100% for invalid filename characters (thanks Guest!)
- Url can now be either from the browser's main address bar OR the 'share' button