Jump to content

Help creating script to run a batch file and hit OK to prompts


Recommended Posts

Hello All--

 

I want to create a script that will run a .bat file that I have made and also click yes to the two prompts that will pop up after the .bat runs...

The script will run the .bat for me but gets hung up at the prompts...

Regedit prompt 1.PNGreg edit prompt 2.PNGautoitscript.png

 

Any help is greatly appreciated.

 

-Gator

Link to comment
Share on other sites

You could do the registry changes in the autoit script without resorting to a batch file and button clicks.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

2 minutes ago, BrewManNH said:

You could do the registry changes in the autoit script without resorting to a batch file and button clicks.

Could you give me a base idea of what the code would look like? I am not the best at programming... I just need a script that would automatically turn on and add the proxy settings. I plan on creating a task in task scheduler to run this script when a user logs on.

Thanks

Link to comment
Share on other sites

  • Moderators

@Gator As BrewManNH states, you can do this natively via AutoIt. How you approach it depends on your bat file:

  • If your bat file is calling REG commands directly, look at the similar commands in the help file (RegRead, RegWrite, RegDelete, etc.)
  • If your bat file is calling a .reg file, simply call it with your AutoIt script and tell it to run silently:
ShellExecute("regedit.exe", "/s <path to filename>")

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

50 minutes ago, JLogan3o13 said:

@Gator As BrewManNH states, you can do this natively via AutoIt. How you approach it depends on your bat file:

  • If your bat file is calling REG commands directly, look at the similar commands in the help file (RegRead, RegWrite, RegDelete, etc.)
  • If your bat file is calling a .reg file, simply call it with your AutoIt script and tell it to run silently:
ShellExecute("regedit.exe", "/s <path to filename>")

 

This worked flawlessly. Thank you for your assistance!

 

-Gator

Link to comment
Share on other sites

I have another question relating to this topic... Say i wanted to have this script edit the registry with TWO different .reg files.... Would i use two separate "ShellExecute" commands? Any help is greatly appreciated!

 

-Gator

Link to comment
Share on other sites

Have you tried?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

2 minutes ago, BrewManNH said:

Have you tried?


I was not able to get it to work using just one "ShellExecute" which is why i posted... I was able to get it to work using two separate scripts however, id like to see if I can just use one.

 

Link to comment
Share on other sites

No, regedit does not support multiple reg files in a single command. If you want to import multiple reg files, you have to execute regedit multiple times.

I guess you could first merge the reg files into one reg file and then run regedit only once with that merged file, but that seems unnecessarily complex. 

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...