Sign in to follow this  
Followers 0
Skribbles

Basic help for a basic guy

6 posts in this topic

Hi Folks,

After some googling I've been led to Autoit. I have a pretty simple problem but my complete lack of scripting knowledge makes it a pretty big problem for me. I have a .reg file that needs to get called from a logon .bat file. It works fine, except that after the .reg file is run, I have to click "Yes" to confirm that I want to run it and then "Okay" once it is done. This will be getting pushed out to a couple hundred users and I can be pretty sure that at least half of them will either click no or call the helpdesk asking what to do (even if we give them detailed instructions on how to click yes and okay).

Thanks!

Share this post


Link to post
Share on other sites



for your problem look at the following function for now:

RegWrite()

with this you can write to the register without needing a click from the users.

an example could look something like this:

RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey", "REG_SZ", "Hello this is a test")

you can find all kind of examples in the documentation of autoit. Also you can open the .reg file with notepad and just watch the values that it copies to the register and then use RegWrite() to do the same with autoit.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Doesn't the "/s" switch in a batch file suppress the confirmation message?

@echo off
regedit /s myregfile.reg

Edit: Are we talking Windows <choke> Vista?

Edited by Spiff59

Share this post


Link to post
Share on other sites

Doesn't the "/s" switch in a batch file suppress the confirmation message?

@echo off
regedit /s myregfile.reg

Edit: Are we talking Windows <choke> Vista?

XP. I know how to right basic batch files and that is it. VB Code scares me. All I'm trying to do is modify the value of "First-Run" to zero and then create the 2nd key without the users interaction.

HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Setup, "First-Run"

HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Setup, "ImportPRF", "REG_SZ", "\\dc1\sysvol\test.local\scripts\prf.reg")

Thanks

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

In that case, Cageman hit the nail on the head.

Look at the examples in the helpfile for RegWrite(), construct yourself a 2-line script consisting of two RegWrite() statements, then compile that to an .exe. Execute the .exe rather than the .bat file you previously used, or, if the .bat file is also performing other functions, insert the .exe into the .bat in place of the regedit call.

Edit: And stop chewing gum while we're talking to you, Britney! :blink:

Edited by Spiff59

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I do like to give back... if I can.

Here's the script you'd want to use.

Two lines are commented out while the other two are not. The commented out lines will set the value to all 0's, while the uncommented lines will delete the key completely and allow Outlook to create them automatically.

#NoTrayIcon
$sPath1 = RegRead("HKCU\Software\Microsoft\Office\11.0\Outlook\Setup", "FirstRun")

Func _AddOutlookPrefs()
    RegDelete("HKCU\Software\Microsoft\Office\11.0\Outlook\Setup", "FirstRun")  ;Removes the key so Outlook will create it automatically on first run.
    RegDelete("HKCU\Software\Microsoft\Office\11.0\Outlook\Setup", "First-Run")  ;Removes the key so Outlook will create it automatically on first run.
;   RegWrite("HKCU\Software\Microsoft\Office\11.0\Outlook\Setup", "FirstRun", "REG_BINARY", "0x0000000000000000")  ;Sets the key to 0's
;   RegWrite("HKCU\Software\Microsoft\Office\11.0\Outlook\Setup", "First-Run", "REG_BINARY", "0x0000000000000000")  ;Sets the key to 0's
    RegWrite("HKCU\Software\Microsoft\Office\11.0\Outlook\Setup", "ImportPRF", "REG_SZ", "\\DC1\NETLOGON\PRF_FILES\DEFAULT.PRF")
EndFunc

If $sPath1 <> "0x000000000000000" Then
    _AddOutlookPrefs()
Else
    Exit
EndIf
Edited by 5t0n3r

Share this post


Link to post
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
Sign in to follow this  
Followers 0