Jump to content

Move a vbs into an AutoIT script


Recommended Posts

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

Link to comment
Share on other sites

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)
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...