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

Author Topic: Automatically click a batch file  (Read 14460 times)

0 Members and 1 Guest are viewing this topic.

zask

    Topic Starter


    Intermediate

    • Experience: Experienced
    • OS: Other
    Automatically click a batch file
    « on: December 29, 2015, 11:36:00 PM »
    okay lets say i have a batch file that says this

    @echo off
    color 17
    set /p "command=Type text here : "
    echo %command%
    pause

    in order for me to type in the display where it says "Type text here :" i have to click on the batch file, is there a way i can automatically click the batch file (in code) without having to click the batch file by mouse?

    Nexusfactor



      Rookie

      • Experience: Experienced
      • OS: Windows 7
      Re: Automatically click a batch file
      « Reply #1 on: December 30, 2015, 06:27:32 AM »
      You can start it from command prompt by doing
      Code: [Select]
      start nameofbatchfile.bat instead of double clicking it.
      The world's #1 Antifeminist

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: Automatically click a batch file
      « Reply #2 on: December 30, 2015, 07:08:33 AM »
      Well... yes.
      OR, he could schedule it  to start at 6:55 every morning.

      Nexusfactor



        Rookie

        • Experience: Experienced
        • OS: Windows 7
        Re: Automatically click a batch file
        « Reply #3 on: December 30, 2015, 08:18:32 AM »
        Well... yes.
        OR, he could schedule it  to start at 6:55 every morning.

        I had the feeling he might have wanted it to be automated :D

        I though it best to wait and see.
        The world's #1 Antifeminist

        zask

          Topic Starter


          Intermediate

          • Experience: Experienced
          • OS: Other
          Re: Automatically click a batch file
          « Reply #4 on: December 30, 2015, 11:23:13 PM »
          I know its possible to run the batch script invisible with vbs, is it possible to do this at the same time?

          foxidrive



            Specialist
          • Thanked: 268
          • Experience: Experienced
          • OS: Windows 8
          Re: Automatically click a batch file
          « Reply #5 on: December 30, 2015, 11:57:02 PM »
          okay lets say i have a batch file that says this

          @echo off
          color 17
          set /p "command=Type text here : "
          echo %command%
          pause

          in order for me to type in the display where it says "Type text here :" i have to click on the batch file, is there a way i can automatically click the batch file (in code) without having to click the batch file by mouse?

          It helps in a programming forum to ask an exact question of what you want to do - because programming is an exact set of steps to solve a specific problem.

          You're not alone in giving examples of a simplistic task - most people ask questions with bogus information.  The problem is that you can't get an accurate answer for an inaccurate question.

          zask

            Topic Starter


            Intermediate

            • Experience: Experienced
            • OS: Other
            Re: Automatically click a batch file
            « Reply #6 on: December 31, 2015, 12:02:52 AM »
            It helps in a programming forum to ask an exact question of what you want to do - because programming is an exact set of steps to solve a specific problem.

            You're not alone in giving examples of a simplistic task - most people ask questions with bogus information.  The problem is that you can't get an accurate answer for an inaccurate question.

            Im sorry that my question appeared bogus, I couldn't think of anyway to explain it any better than i want the file to automatically click itself at start, but if it helps Nexusfactor answered my previous question

            foxidrive



              Specialist
            • Thanked: 268
            • Experience: Experienced
            • OS: Windows 8
            Re: Automatically click a batch file
            « Reply #7 on: December 31, 2015, 07:18:17 AM »
            I couldn't think of anyway to explain it any better than i want the file to automatically click itself at start
            "click itself at start" gives your readers no idea of what you are doing.  It doesn't mean anything.
            Explaining the task doesn't hurt, surely. ;)

            zask

              Topic Starter


              Intermediate

              • Experience: Experienced
              • OS: Other
              Re: Automatically click a batch file
              « Reply #8 on: January 01, 2016, 11:04:25 AM »
              "click itself at start" gives your readers no idea of what you are doing.  It doesn't mean anything.
              Explaining the task doesn't hurt, surely. ;)

              well i did add an explanation

              "in order for me to type in the display where it says "Type text here :" i have to click on the batch file, is there a way i can automatically click the batch file (in code) without having to click the batch file by mouse?"

              Geek-9pm


                Mastermind
              • Geek After Dark
              • Thanked: 1026
                • Gekk9pm bnlog
              • Certifications: List
              • Computer: Specs
              • Experience: Expert
              • OS: Windows 10
              Re: Automatically click a batch file
              « Reply #9 on: January 01, 2016, 11:12:00 AM »
              Define "automatic".
              If using windows 7 speech recognition, you could say "click on the batch file" and it would start. But of course, you would have to have your microphone on and the speech module  loaded.

              Batch, of itself, has not even-driven triggers. It has to have some other code start it upon a specific external event. Such as the user touching something to doing something the computer can sense. Telepathy will not be available for at least seven years. Or more.   ::)

              BC_Programmer


                Mastermind
              • Typing is no substitute for thinking.
              • Thanked: 1140
                • Yes
                • Yes
                • BC-Programming.com
              • Certifications: List
              • Computer: Specs
              • Experience: Beginner
              • OS: Windows 11
              Re: Automatically click a batch file
              « Reply #10 on: January 01, 2016, 11:18:25 AM »
              From what I understand, zask's "issue" is that when he double-clicks a batch file on his desktop, it doesn't have focus, so they need to click it to give it focus, and they want it to do this "automatically".

              The confusion likely stems from how this behaviour makes no sense whatsoever. I can't reproduce it anywhere, on any system. if I double click a batch file, it launches and it has the focus.
              I was trying to dereference Null Pointers before it was cool.

              zask

                Topic Starter


                Intermediate

                • Experience: Experienced
                • OS: Other
                Re: Automatically click a batch file
                « Reply #11 on: January 01, 2016, 12:46:36 PM »
                From what I understand, zask's "issue" is that when he double-clicks a batch file on his desktop, it doesn't have focus, so they need to click it to give it focus, and they want it to do this "automatically".

                The confusion likely stems from how this behaviour makes no sense whatsoever. I can't reproduce it anywhere, on any system. if I double click a batch file, it launches and it has the focus.

                okay i will try to explain, lets say you have a batch fie on your desktop and you click it, then it displays a prompt that says "type here : " if you type anything it will not type until you click the prompt. I am trying to make it automatically type inside the prompt when the file is open, instead of opening the the prompt, clicking it, and then typing. Does that make any more sense?????

                zask

                  Topic Starter


                  Intermediate

                  • Experience: Experienced
                  • OS: Other
                  Re: Automatically click a batch file
                  « Reply #12 on: January 01, 2016, 12:47:11 PM »
                  like really it's not that hard to understand

                  BC_Programmer


                    Mastermind
                  • Typing is no substitute for thinking.
                  • Thanked: 1140
                    • Yes
                    • Yes
                    • BC-Programming.com
                  • Certifications: List
                  • Computer: Specs
                  • Experience: Beginner
                  • OS: Windows 11
                  Re: Automatically click a batch file
                  « Reply #13 on: January 01, 2016, 12:53:41 PM »
                  I knew what you meant. And like I said, the confusion probably stems from the fact that what you describe simply is not what happens in a typical Windows Install. If I double-click a batch file on my desktop- or the desktop of any of my Windows systems, keyboard input goes to the command prompt window that appears. I do not have to click it unless I intentionally click elsewhere first. I can double-click the batch file, completely let go of the mouse, and type in the command prompt window without clicking it.
                  I was trying to dereference Null Pointers before it was cool.

                  Geek-9pm


                    Mastermind
                  • Geek After Dark
                  • Thanked: 1026
                    • Gekk9pm bnlog
                  • Certifications: List
                  • Computer: Specs
                  • Experience: Expert
                  • OS: Windows 10
                  Re: Automatically click a batch file
                  « Reply #14 on: January 01, 2016, 01:33:37 PM »
                  From this page...
                  http://www.computerhope.com/sethlp.htm
                  Code: [Select]
                  @ECHO off
                  cls
                  :start
                  ECHO.
                  ECHO 1. Print Hello
                  ECHO 2. Print Bye
                  ECHO 3. Print Test
                  set choice=
                  set /p choice=Type the number to print text.
                  if not '%choice%'=='' set choice=%choice:~0,1%
                  if '%choice%'=='1' goto hello
                  if '%choice%'=='2' goto bye
                  if '%choice%'=='3' goto test
                  ECHO "%choice%" is not valid, try again
                  ECHO.
                  goto start
                  :hello
                  ECHO HELLO
                  goto end
                  :bye
                  ECHO BYE
                  goto end
                  :test
                  ECHO TEST
                  goto end
                  :end
                  Is that what he wants?  :D