Sign in to follow this  
Followers 0
acidfear

Help Registry

7 posts in this topic

I'm having trouble with this code

if $msg = $Button_6 Then
    
        regwrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters", "CacheHashTableBucketSize", "Reg_dword", 1)
        regwrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters", "CacheHashTableSize", "Reg_dword", 180)
        regwrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters", "MaxCacheEntryTtlLimit", "Reg_dword", "fa00 ")
        regwrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters", "MaxSOACacheEntryTtlLimit", "Reg_dword", "1b")
        GUICtrlSetData($edit_6, "Done")
    ElseIf @error = 1 Then
        GUICtrlSetData($edit_6, "Error")
EndIf

It will only write the first line.

Share this post


Link to post
Share on other sites



The RegWrite() function writes 4 lines. There must be a prob with another part of your code.

Share this post


Link to post
Share on other sites

Could it be that regwrite doesn't write anything but number?

heres the entire code

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("Registry Tweaks", 442, 805,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Delete Shortcut Arrows (on Shortcuts)", 20, 20, 220, 30)
$Button_2 = GuiCtrlCreateButton("Disable Balloon Tips", 20, 110, 220, 30)
$Button_3 = GuiCtrlCreateButton("Unload Dll's of Closed Apps", 20, 200, 220, 30)
$Button_4 = GuiCtrlCreateButton("Improve NTFS Performance", 20, 290, 220, 30)
$Button_5 = GuiCtrlCreateButton("Disable AutoPlay of Drives", 20, 380, 220, 30)
$Button_6 = GuiCtrlCreateButton("Speed Up Internet - DNS Tweak", 20, 480, 220, 30)
$Button_7 = GuiCtrlCreateButton("Change Menu Display Speed", 20, 580, 220, 30)
$Button_8 = GuiCtrlCreateButton("Refresh", 20, 740, 100, 30)
$Button_9 = GuiCtrlCreateButton("Exit", 330, 740, 100, 30)
$Edit_1 = GuiCtrlCreateEdit("Ready", 270, 20, 160, 40,BitOR($ES_AUTOHSCROLL, $ES_PASSWORD))
$Edit_2 = GuiCtrlCreateEdit("Ready", 270, 100, 160, 40, BitOR($ES_AUTOHSCROLL, $ES_PASSWORD))
$Edit_3 = GuiCtrlCreateEdit("Ready", 270, 200, 160, 40,BitOR($ES_AUTOHSCROLL, $ES_PASSWORD))
$Edit_4 = GuiCtrlCreateEdit("Ready", 270, 290, 160, 40,BitOR($ES_AUTOHSCROLL, $ES_PASSWORD))
$Edit_5 = GuiCtrlCreateEdit("Ready", 270, 380, 160, 40,BitOR($ES_AUTOHSCROLL, $ES_PASSWORD))
$Edit_6 = GuiCtrlCreateEdit("Ready", 270, 480, 160, 40,BitOR($ES_AUTOHSCROLL, $ES_PASSWORD))
$Edit_7 = GuiCtrlCreateEdit("Ready", 270, 580, 160, 40,BitOR($ES_AUTOHSCROLL, $ES_PASSWORD))
$input_1 = GUICtrlCreateInput("Input Value Here **SEE README**", 20, 612, 220, 20)


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
EndSelect


;;;;;;;;;;;;;;Button 1;;;;;;;;;;;;;;;;
if $msg = $button_1 then
        RegDelete("HKEY_CLASSES_ROOT\lnkfile", "IsShortcut")
        RegDelete("HKEY_CLASSES_ROOT\InternetShortcut", "IsShortcut")
        RegDelete("HKEY_CLASSES_ROOT\piffile", "IsShortcut")
        GUICtrlSetData($edit_1, "Done")
    ElseIf @error = 2 Then
        GUICtrlSetData($edit_1, "Error")
    
EndIf
;;;;;;;;;;;;;;;End;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;Button 2;;;;;;;;;;;;;;;;;;

if $msg = $button_2 Then
    $reg_1 = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableBalloonTips")
    if $reg_1 = 1 Then
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableBalloonTips", "Reg_dword", 0)
    elseif @error = 0 Then
        GUICtrlSetData($edit_2, "Error")
    EndIf
        GUICtrlSetData($edit_2, "Done")

EndIf
;;;;;;;;;;;;;;;;;;End;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;Button 3;;;;;;;;;;;;;;;;;;
if $msg = $Button_3 Then
    $reg_2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "AlwaysUnloadDll")
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "AlwaysUnloadDll", "reg_dword", 1)
    GUICtrlSetData($edit_3, "Done")

    Elseif @error = 1 Then
    
    GUICtrlSetData($edit_3, "Error")
    

EndIf
;;;;;;;;;;;;;;;End;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;Button 4;;;;;;;;;;;;;;;;
if $msg = $Button_4 Then
        RegWrite("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem", "NtfsDisable8dot3NameCreation", "reg_dword", 1)
        RegWrite("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem", "NtfsDisableLastAccessUpdate", "reg_dword", 1)
        GUICtrlSetData($edit_4, "Done")
    Elseif @error = 1 Then
        GUICtrlSetData($edit_4, "Error")

EndIf
;;;;;;;;;;;;;;;;;End;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;Button 5;;;;;;;;;;;;;;;
if $msg = $Button_5 Then
    regwrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom", "AutoRun", "Reg_Dword", 0)
    GUICtrlSetData($edit_5, "Done")
    Elseif @error = 1 Then
    GUICtrlSetData($edit_5, "Error")

endif
;;;;;;;;;;;;;;;;;;;;End;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;Button 6;;;;;;;;;;;;;
if $msg = $Button_6 Then
    
        regwrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters", "CacheHashTableBucketSize", "Reg_dword", 1)
        regwrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters", "CacheHashTableSize", "Reg_dword", 180)
        regwrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters", "MaxCacheEntryTtlLimit", "Reg_dword", "fa00 ")
        regwrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters", "MaxSOACacheEntryTtlLimit", "Reg_dword", "1b")
        GUICtrlSetData($edit_6, "Done")
    ElseIf @error = 1 Then
        GUICtrlSetData($edit_6, "Error")
EndIf
;;;;;;;;;;;;;;;;;;;;End;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;Button 7;;;;;;;;;;;;;
if $msg = $Button_7 Then
    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "MenuShowDelay", "REG_SZ", $input_1)
    GUICtrlSetData($edit_7, "Done")
    Elseif @error = 1 Then
    GUICtrlSetData($edit_7, "Error")
EndIf
;;;;;;;;;;;;;;;;;;;;End;;;;;;;;;;;;;;;;;

















if $msg = $button_8 Then
    GUICtrlSetData($edit_1,"Ready")
    
    GUICtrlSetData($edit_2,"Ready")

    GUICtrlSetData($edit_3,"Ready")

    GUICtrlSetData($edit_4,"Ready")

    GUICtrlSetData($edit_5,"Ready")

    GUICtrlSetData($edit_6,"Ready")

    GUICtrlSetData($edit_7,"Ready")
    
    GUICtrlSetData($input_1,"")
    EndIf



if $msg=$button_9 Then
    Exit
    EndIf




WEnd
Exit
#endregion --- GuiBuilder generated code End ---

Share this post


Link to post
Share on other sites

Ahh I see it. You choose always 'REG_DWORD'. 'REG_DWORD' accepts only numbers dec or hex. You have to know what kind of key you want write. Maybe 'REG_SZ' is sometimes requiered.

Share this post


Link to post
Share on other sites

These reg entries, i read, are to be created as a new Dword. So if i change it to REG_SZ will it matter?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ahh, nevermind. FIgured it out.

What i needed to do is instead of typing in manualy the REG_DWORD value of "fa00", i had to find out what the numerical value would be of "fa00", which i did by manualy typing in "fa00" in the registry which gave me the numerical value of "86400", now to REG_WRITE it as a REG_DWORD, all i had to do was set the value to 86400 and it would automatically change the hex value to 0x0000fa00 :whistle:

Thanks for all those who helped

Edited by acidfear

Share this post


Link to post
Share on other sites

Ahh, nevermind. FIgured it out.

What i needed to do is instead of typing in manualy the REG_DWORD value of "fa00", i had to find out what the numerical value would be of "fa00", which i did by manualy typing in "fa00" in the registry which gave me the numerical value of "86400", now to REG_WRITE it as a REG_DWORD, all i had to do was set the value to 86400 and it would automatically change the hex value to 0x0000fa00 :)

Thanks for all those who helped

For future reference, AutoIT will take hex numbers as numeric operators and you don't have to provide all the leading zeroes, just put 0x in front and take the quotes off. So 0xfa00 would have worked (without quotes). Putting quotes around "86400" only works because AutoIT automatically translates strings to numbers where required, and only if there are only numeric characters in the string, so the "x" in a hex number prevents that.

In some circumstances, using 86400 (without quotes) and "86400" (with quotes) does not produce the same results. See functions like Number() and String() in the help file.

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0