No internet connection
  1. Home
  2. How to

Coding a pop up text box..

By Matt Hennessy @Matt_Hennessy
    2022-01-22 17:08:25.874Z

    Hey all.

    Is there a way to code a text input box to pop up for me to input variables that wi need to be used repeatedly in a bounce script?

    For example I have a script that bounces a bunch of tracks in a sequence. Currently it names those bounces with the name of the track it is bouncing.

    It would be dope if I could have a text input at the beginning of the script to enter file naming structure and a second for sample rate/bit depth.

    So the bounced file name would go from

    “Kick”

    To

    (User entered variable 1)Kick(User entered variable 2)

    Finally result might look like this

    JR_Titan Theme_MH 1_Kick_96k24

    Thanks

    • 11 replies
    1. Hi Matt,

      You can use prompt - but only for one variable at a time.

      Like:

      var bounceName = prompt(`Please type the name of the bounce`);
      
      1. M
        In reply toMatt_Hennessy:
        Matt Hennessy @Matt_Hennessy
          2022-01-22 17:22:35.861Z

          That’s dope - exactly what I was looking for. Will work with this on Monday but I bet this is exactly what I was looking for thank you!

          1. M
            In reply toMatt_Hennessy:
            Matt Hennessy @Matt_Hennessy
              2022-01-22 22:04:53.743Z

              @chrscheuer follow up question.

              Is there a way to pull system information like the date?

              For some file naming scripts it would be VERY cool to be able to pull date data and place it at the end of the name string formatted year/month/day.

              Ex; 220122

              Thanks 🙏🏼

              1. Dustin Harris @Dustin_Harris
                  2022-01-22 23:28:38.821Z

                  HI @Matt_Hennessy! Try this for today's date:

                  let todaysDate = new Date().toDateString();
                  log(todaysDate);
                  //Sat Jan 22 2022
                  
                  1. In reply toMatt_Hennessy:
                    Dustin Harris @Dustin_Harris
                      2022-01-22 23:35:22.227Z

                      oh, and the way you want it formatted:

                      const date = new Date();
                      const year = date.getFullYear()
                      const month = String(date.getMonth()+1).padStart(2, "0")
                      const day = String(date.getDate()).padStart(2, "0")
                      const formattedDate = `${year}/${month}/${day}`
                      log (formattedDate)
                      
                      1. MMatt Hennessy @Matt_Hennessy
                          2022-01-22 23:42:08.561Z

                          So I add both of those code blocks and then

                          “Todaysdate” is the way I add that to the text string?

                          1. Dustin Harris @Dustin_Harris
                              2022-01-22 23:45:47.745Z

                              yeah exactly! I'd do it like this:

                              const date = new Date();
                              const year = date.getFullYear()
                              const month = String(date.getMonth()+1).padStart(2, "0")
                              const day = String(date.getDate()).padStart(2, "0")
                              const formattedDate = `${year}/${month}/${day}`
                              
                              var bounceName = prompt(`Please type the name of the bounce`);
                              var bounceNameWithDate = bounceName + formattedDate;
                              
                              log(bounceNameWithDate)
                              
                              1. MMatt Hennessy @Matt_Hennessy
                                  2022-01-23 00:01:13.221Z

                                  In this example the date would print

                                  2022/01/22 right?

                                  I would want it to say

                                  220122

                                  1. Dustin Harris @Dustin_Harris
                                      2022-01-23 03:13:01.336Z

                                      coming right up!

                                      const date = new Date();
                                      const year = date.getFullYear().toString().slice(-2)
                                      const month = String(date.getMonth()+1).padStart(2, "0")
                                      const day = String(date.getDate()).padStart(2, "0")
                                      const formattedDate = `${year}${month}${day}`
                                      
                                      var bounceName = prompt(`Please type the name of the bounce`);
                                      var bounceNameWithDate = bounceName + "_" + formattedDate;
                                      
                                      log(bounceNameWithDate)
                                      
                                • In reply toDustin_Harris:
                                  MMatt Hennessy @Matt_Hennessy
                                    2022-01-22 23:43:56.372Z

                                    Oh i see.

                                    Formatteddate. Cool! Can’t wait to dive in on this

                                    1. MMatt Hennessy @Matt_Hennessy
                                        2022-01-23 03:23:21.572Z

                                        Amazing - thanks so much @Dustin_Harris

                                        You guys really are so wonderful. 🙏🏼❤️