bob.frew Posted December 4, 2009 Posted December 4, 2009 Hi folks, I'll apologise in advance. This is probably one of those daft things I can't see for looking. I'm on Windows 7 32 bit with AutoIt V3.3.0.0 Windows keeps losing a setting for the Logon screen when I switch themes (I do that a lot as I prefer high contrast black background) I use a small Autoit script to do the switch of theme so I figured I would just ensure that the registry setting was as it should be at the end of the process. Opt ("ExpandEnvStrings", 0) Opt ("ExpandVarStrings", 1) Opt ("MustDeclareVars", 1) #include <GUIConstants.au3> Dim $keyname = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background" Dim $valuename = "OEMBackground" Dim $type = "REG_DWORD" Dim $val = 1; "1"; 0x00000001; "0x00000001"; 00000001; "00000001"; readReg() writeReg() readReg() Exit ; ------------------------------------------------------------------------------- Func readReg() Local $var = RegRead($keyname, $valuename) MsgBox(4096, "value found = ", $var) EndFunc ; ------------------------------------------------------------------------------- Func writeReg() Local $var = RegWrite($keyname, $valuename, $type, $val) MsgBox(4096, "return after write = ", $var) EndFunc This is my first attempt at accessing the registry The RegWrite command always returns 0. The RegRead seems ok, so the problem must be in the other parameters. I have tried all variations I can think of. If it was a basic getting access at all kind of thing, then why can I make this change using Regedit All help greatly appreciated Bob AutoIt is great - leave me alone and I'll play for hours
funkey Posted December 4, 2009 Posted December 4, 2009 And what @error do you get? Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
Raven1 Posted December 5, 2009 Posted December 5, 2009 I think that if you run it as administrator it will return 1 in the message boxes. At least it did on my PC, but I have Vista x64. You could set the AutoIt3Wrapper to modify the manifest file so that it will always require administrator approval when executing. #Region AutoIt3Wrapper directives section #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator ;None, asInvoker, highestAvailable or requireAdministrator (default=None) #EndRegion One of the advantages to this method over the #RequireAdmin method is that you will get the UAC shield overlay on your icon.
bob.frew Posted December 5, 2009 Author Posted December 5, 2009 Many thanks for replies Sorry funkey I should have said that @error returned a 1 I have gone from XP to Windows 7 so this is the first I knew of this authorisation business. As I am the sole user and classed as Administrator you would think that gave me access to everything. Seems I am wrong. RegWrite now works after I added the #requireadmin line So at least I can use the script Have to do more reading to be able follow your alternate Raven1 Thanks again people p.s. Anyone know how to do a #requireadmin("YES") kind of thing to lose the MS dialog box ??? AutoIt is great - leave me alone and I'll play for hours
Developers Jos Posted December 5, 2009 Developers Posted December 5, 2009 p.s. Anyone know how to do a #requireadmin("YES") kind of thing to lose the MS dialog box ???When that were possible wouldn't that make the whole UAC obsolete? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now