Jump to content

regwrite and _ispressed


bird42
 Share

Recommended Posts

Hello guys! I need some help :).

1)

RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run","autoavvio",-1,@SystemDir&"\"&@ScriptName)

What's wrong? I can't write keys.

2)

If _IsPressed(43) Then
    _write("c")
EndIf

This will result in " cccccccccccccccccccccccccccccccccccccccc".

Help me to get to "c".

Thanks a lot for your help.

Link to comment
Share on other sites

Hello guys! I need some help :).

1)

RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run","autoavvio",-1,@SystemDir&"\"&@ScriptName)

What's wrong? I can't write keys.

2)

If _IsPressed(43) Then
    _write("c")
EndIf

This will result in " cccccccccccccccccccccccccccccccccccccccc".

Help me to get to "c".

Thanks a lot for your help.

Hi,

1) Check if the key is really a REG_SZ. See helpfile for more information:

("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run","autoavvio","REG_SZ",@SystemDir&"\"&@ScriptName)

2) Please post code of your _write function. Check if you really press the c once.

;-))

Stefan

Link to comment
Share on other sites

  • Moderators

zentral,

You need to wait until the key is released - and as you are continually polling _IsPressed, it is best to open and close the DLL:

#include <Misc.au3>

$iCount = 0 ; to show there is just 1 per press

$dll = DllOpen("user32.dll")

While 1
    If _IsPressed("43", $dll) Then
        $iCount += 1
        ConsoleWrite("c " & $iCount & @CRLF)
        While _IsPressed("43", $dll)
            Sleep(10)
        WEnd
    EndIf
    If _IsPressed("1B", $dll) Then ExitLoop
WEnd

DllClose($dll)

M23

Edit: Looking at the RegWrite, you have set the "type" parameter to "-1". From the help file:

AutoIt supports registry keys of type REG_BINARY, REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ, REG_QWORD, and REG_DWORD

I do not believe "-1" is a valid parameter here - it should be one of the above as a literal string.

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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