Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: User Input Time Limit  (Read 6134 times)

0 Members and 1 Guest are viewing this topic.

Xenfire

    Topic Starter


    Rookie

    Thanked: 1
    User Input Time Limit
    « on: April 29, 2009, 06:38:10 PM »
    Is there a possible way to ask for user input, but if they take too long to input, the script would continue?

    Example

    @echo off
    echo Enter something here.
    set /p a=
    (if 3 seconds pass and nothing has been written, continue with script)
    *commands*


    Help?

    Helpmeh



      Guru

    • Roar.
    • Thanked: 123
      • Yes
      • Yes
    • Computer: Specs
    • Experience: Familiar
    • OS: Windows 8
    Re: User Input Time Limit
    « Reply #1 on: April 29, 2009, 06:43:35 PM »
    Is there a possible way to ask for user input, but if they take too long to input, the script would continue?

    Example

    @echo off
    echo Enter something here.
    set /p a=
    (if 3 seconds pass and nothing has been written, continue with script)
    *commands*


    Help?

    Choice.exe can acomplish ths Jakob. (Download from CH Downloads section)

    Edit: Although every computer that the batch script will be on must have choice.exe (or .com) on it.
    « Last Edit: April 29, 2009, 07:01:21 PM by Helpmeh »
    Where's MagicSpeed?
    Quote from: 'matt'
    He's playing a game called IRL. Great graphics, *censored* gameplay.

    Xenfire

      Topic Starter


      Rookie

      Thanked: 1
      Re: User Input Time Limit
      « Reply #2 on: April 29, 2009, 09:42:36 PM »
      *censored* you

      what would I write.

      macdad-



        Expert

        Thanked: 40
        Re: User Input Time Limit
        « Reply #3 on: April 30, 2009, 11:24:35 AM »
        This may clear it up:

        Code: [Select]
        @echo off
        :main
        choice /C:YN /T:N,3 Would you like to enter something
        if ERRORLEVEL 2 goto entercmd
        <your commands here>
        goto end

        :entercmd
        set /p input=Enter something:
        goto main

        :end
        exit

        That help?

        If you dont know DOS, you dont know Windows...

        Thats why Bill Gates created the Windows NT Family.

        Xenfire

          Topic Starter


          Rookie

          Thanked: 1
          Re: User Input Time Limit
          « Reply #4 on: April 30, 2009, 03:14:16 PM »
          This may clear it up:

          Code: [Select]
          @echo off
          :main
          choice /C:YN /T:N,3 Would you like to enter something
          if ERRORLEVEL 2 goto entercmd
          <your commands here>
          goto end

          :entercmd
          set /p input=Enter something:
          goto main

          :end
          exit

          That help?


          Yes, thank you.

          Helpmeh



            Guru

          • Roar.
          • Thanked: 123
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Familiar
          • OS: Windows 8
          Re: User Input Time Limit
          « Reply #5 on: May 02, 2009, 04:31:35 PM »
          Yes, thank you.
          If you are planning to use that where I think you will want to use that, you need to know that choice.exe (or .com) must be included with the script, because where I think you want to use it does not have choice.exe or choice.com .
          Where's MagicSpeed?
          Quote from: 'matt'
          He's playing a game called IRL. Great graphics, *censored* gameplay.

          macdad-



            Expert

            Thanked: 40
            Re: User Input Time Limit
            « Reply #6 on: May 02, 2009, 04:48:26 PM »
            Very true, Helpmeh.

            Xenfire for an NT version(Win2K, XP, and Vista) of Choice use this:Link
            If you have an OS older than Win2K, then CHOICE.COM is probably on there already.
            If you dont know DOS, you dont know Windows...

            Thats why Bill Gates created the Windows NT Family.

            Helpmeh



              Guru

            • Roar.
            • Thanked: 123
              • Yes
              • Yes
            • Computer: Specs
            • Experience: Familiar
            • OS: Windows 8
            Re: User Input Time Limit
            « Reply #7 on: May 02, 2009, 04:52:19 PM »
            Very true, Helpmeh.

            Xenfire for an NT version(Win2K, XP, and Vista) of Choice use this:Link
            If you have an OS older than Win2K, then CHOICE.COM is probably on there already.
            The OS for what I'm about 99% sure he's thinking of putting it on is XP Pro. Although there is like a 0.0001% chance that the Admins put it on...even though that would be completely stupid...
            Where's MagicSpeed?
            Quote from: 'matt'
            He's playing a game called IRL. Great graphics, *censored* gameplay.

            macdad-



              Expert

              Thanked: 40
              Re: User Input Time Limit
              « Reply #8 on: May 02, 2009, 04:56:23 PM »
              Yea, and if he had Windows 2003 he wouldn't need to download it, it comes with it.
              If you dont know DOS, you dont know Windows...

              Thats why Bill Gates created the Windows NT Family.

              Helpmeh



                Guru

              • Roar.
              • Thanked: 123
                • Yes
                • Yes
              • Computer: Specs
              • Experience: Familiar
              • OS: Windows 8
              Re: User Input Time Limit
              « Reply #9 on: May 02, 2009, 05:02:52 PM »
              Yea, and if he had Windows 2003 he wouldn't need to download it, it comes with it.
              I'm not sure what OS he has at home...but what I'm fairly sure he will be doing with it will not be used at home...
              Where's MagicSpeed?
              Quote from: 'matt'
              He's playing a game called IRL. Great graphics, *censored* gameplay.

              macdad-



                Expert

                Thanked: 40
                Re: User Input Time Limit
                « Reply #10 on: May 03, 2009, 11:38:36 AM »
                True, Windows 2003 is more or less used as a Server OS, not really intended as a Home OS.
                If you dont know DOS, you dont know Windows...

                Thats why Bill Gates created the Windows NT Family.

                Helpmeh



                  Guru

                • Roar.
                • Thanked: 123
                  • Yes
                  • Yes
                • Computer: Specs
                • Experience: Familiar
                • OS: Windows 8
                Re: User Input Time Limit
                « Reply #11 on: May 03, 2009, 01:15:05 PM »
                Just looked, he has WIN XP (so does where the script will probably be put into affect)...so choice must be included...
                Where's MagicSpeed?
                Quote from: 'matt'
                He's playing a game called IRL. Great graphics, *censored* gameplay.

                macdad-



                  Expert

                  Thanked: 40
                  Re: User Input Time Limit
                  « Reply #12 on: May 03, 2009, 04:43:39 PM »
                  Not necessarily, I have Win XP Pro and choice isn't on mine.

                   
                  If you dont know DOS, you dont know Windows...

                  Thats why Bill Gates created the Windows NT Family.

                  Helpmeh



                    Guru

                  • Roar.
                  • Thanked: 123
                    • Yes
                    • Yes
                  • Computer: Specs
                  • Experience: Familiar
                  • OS: Windows 8
                  Re: User Input Time Limit
                  « Reply #13 on: May 10, 2009, 10:50:41 AM »
                  Not necessarily, I have Win XP Pro and choice isn't on mine.

                   
                  Choice must be INCLUDED...as in with the script package.
                  Where's MagicSpeed?
                  Quote from: 'matt'
                  He's playing a game called IRL. Great graphics, *censored* gameplay.

                  macdad-



                    Expert

                    Thanked: 40
                    Re: User Input Time Limit
                    « Reply #14 on: May 10, 2009, 03:02:53 PM »
                    What service pack do you have?

                    I have SP3
                    If you dont know DOS, you dont know Windows...

                    Thats why Bill Gates created the Windows NT Family.

                    Helpmeh



                      Guru

                    • Roar.
                    • Thanked: 123
                      • Yes
                      • Yes
                    • Computer: Specs
                    • Experience: Familiar
                    • OS: Windows 8
                    Re: User Input Time Limit
                    « Reply #15 on: May 10, 2009, 03:06:05 PM »
                    What service pack do you have?

                    I have SP3
                    SP2...I can't get SP3
                    Where's MagicSpeed?
                    Quote from: 'matt'
                    He's playing a game called IRL. Great graphics, *censored* gameplay.

                    macdad-



                      Expert

                      Thanked: 40
                      Re: User Input Time Limit
                      « Reply #16 on: May 10, 2009, 03:14:18 PM »
                      Interesting...wonder why they cut out Choice in SP3....

                      Oh well.
                      If you dont know DOS, you dont know Windows...

                      Thats why Bill Gates created the Windows NT Family.

                      Helpmeh



                        Guru

                      • Roar.
                      • Thanked: 123
                        • Yes
                        • Yes
                      • Computer: Specs
                      • Experience: Familiar
                      • OS: Windows 8
                      Re: User Input Time Limit
                      « Reply #17 on: May 10, 2009, 03:22:07 PM »
                      Interesting...wonder why they cut out Choice in SP3....

                      Oh well.
                      It's not in SP2.
                      Where's MagicSpeed?
                      Quote from: 'matt'
                      He's playing a game called IRL. Great graphics, *censored* gameplay.