isstjjh Posted April 6, 2009 Posted April 6, 2009 Could someone assist me with making the following VBS file into an AutoIt file? ' Create temp file with the script that regini.exe will use ' set oFSO = CreateObject("Scripting.FileSystemObject") strFileName = oFSO.GetTempName set oFile = oFSO.CreateTextFile(strFileName) oFile.WriteLine "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg [1 5 7 11 17]" oFile.Close ' Change registry permissions with regini.exe ' set oShell = CreateObject("WScript.Shell") oShell.Run "regini " & strFileName, 8, true ' Delete temp file ' oFSO.DeleteFile strFileName
DaRam Posted April 6, 2009 Posted April 6, 2009 Instead of using Regini.Exe, why not use AutoIt's RegWrite Function?Look up RegWrite in AutoIt Help. And if you need to know, what the impact is of creating/modify power schemes using this registry key here http://support.microsoft.com/kb/915160
erik7426 Posted April 6, 2009 Posted April 6, 2009 Instead of using Regini.Exe, why not use AutoIt's RegWrite Function?Look up RegWrite in AutoIt Help. And if you need to know, what the impact is of creating/modify power schemes using this registry key here http://support.microsoft.com/kb/915160I think he is wanting to change the ACL for that registry key.
isstjjh Posted April 6, 2009 Author Posted April 6, 2009 This script modifies permissions of the powercfg key which is essential for what I am using this for. I do not see that ability in the RegWrite function.
DaRam Posted April 6, 2009 Posted April 6, 2009 erik7426, You were right. isstjjh, something like this might be the equivalent: #include <File.au3> Dim $s_TempFile, $file ; generate unique filename in @TempDir $s_TempFile = _TempFile() $file = FileOpen($s_TempFile, 1) If $file = -1 Then MsgBox(0, "Error", "Unable to Create file " & $s_TempFile) Exit EndIf FileWriteLine($file, "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg [1 5 7 11 17]") FileClose($file) Run("regini " & $s_TempFile, "", @SW_MAXIMIZE)
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