Jump to content
Sign in to follow this  
isstjjh

Move a vbs into an AutoIT script

Recommended Posts

isstjjh

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

Share this post


Link to post
Share on other sites
DaRam

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

Share this post


Link to post
Share on other sites
erik7426

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

I think he is wanting to change the ACL for that registry key.

Share this post


Link to post
Share on other sites
isstjjh

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.

Share this post


Link to post
Share on other sites
DaRam

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)

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  

×