Sign in to follow this  
Followers 0
bird42

regwrite and _ispressed

4 posts in this topic

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks 99ojo and Melba23 ! Now it works.

:);)B) B) B) B) :D

Edited by zentral

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