Jump to content

Recommended Posts

Posted (edited)

Hello,

I made this simple RegWrite example.

If IsAdmin() Then
    MsgBox(64, "Succes", "Admin rights detected! You can safely use the program.")
Else
    MsgBox(16, "ERROR", "No Admin rights detected! Program will exit now!")
    Exit
EndIf

$GUI = GUICreate("iRun - Make programs run at windows start!", 260, 145, -1, -1)
GUICtrlCreateLabel("Select the file that sould be started at windows start.", 10, 10)
$Input1 = GUICtrlCreateInput("", 10, 30, 215)
$Button1 = GUICtrlCreateButton("...", 230, 28, 25, 23)
$Radio1 = GUICtrlCreateRadio("Always", 10, 60)
$Radio2 = GUICtrlCreateRadio("Only on this account", 10, 80)
$Button2 = GUICtrlCreateButton("Go!", 10, 110, 100)
GUICtrlSetState($Radio1, 1)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = -3
        Exit
    Case $nMsg = $Button1
        $fod = FileOpenDialog("Select your file", @DesktopDir, "All Files (*.*)")
        If @error = 1 Then
        Else
            GUICtrlSetData($Input1, $fod)
        EndIf
    Case $nMsg = $Button2
        $Read_Radio1 = GUICtrlRead($Radio1)
        $Read_Input1 = GUICtrlRead($Input1)
        If $Read_Radio1 = 1 Then
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @UserName & " Run", "REG_SZ", $Read_Input1)
        Else
            RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", @UserName & " Run", "REG_SZ", $Read_Input1)
        EndIf
        MsgBox(0, "", "File added!")
    EndSelect
WEnd

Actualy, I was bored :)

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted

  AlmarM said:

Easy to fix this... Check my first post again!

AlmarM

That's not fix.

Fix would be using keyword:

#RequireAdmin

@SwiftBurns; you can do what ever you want with HKEY_CURRENT_USER on Vista. If using keyword #RequireAdmin in your script you have ability to do the same thing with HKEY_CLASSES_ROOT or HKEY_CURRENT_CONFIG and not fully everything with HKEY_LOCAL_MACHINE and HKEY_USERS.

♡♡♡

.

eMyvnE

Posted

  trancexx said:

That's not fix.

Fix would be using keyword:

#RequireAdmin

@SwiftBurns; you can do what ever you want with HKEY_CURRENT_USER on Vista. If using keyword #RequireAdmin in your script you have ability to do the same thing with HKEY_CLASSES_ROOT or HKEY_CURRENT_CONFIG and not fully everything with HKEY_LOCAL_MACHINE and HKEY_USERS.

Yes I know...

But if I put that in it, the user who use it, will not know why the scripts doenst work.

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted

  trancexx said:

And will not work because... ?

Because you said:

  trancexx said:

You cannot write to HKLM on Vista unless having full administrator rights.

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted

nice tool. one thing from my side. if you don't select anything and click go it will add a blank line. maybe you can build in an error if nothing was selected. otherwise no sense in that.

thanks

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...