Jump to content

Problem with Hotkey


 Share

Recommended Posts

when I use the hotkey to paste a text (average along) in another window the buttons ctrl+alt remain pressed until i hit it again

With this simple program you can see the problem, copy the my previous text in the editbox and after use ctrl+alt+z to paste on a txt or a window messenger.

#include <GuiConstants.au3>
#NoTrayIcon

Opt("GUIOnEventMode", 1)

CheckPID()

HotKeySet("^!z", "paste")

GuiCreate("MacroPaste by Kurtferro", 310, 200)
WinSetOnTop("MacroPaste by Kurtferro", "", 1)
WinSetTrans("MacroPaste by Kurtferro", "", 245)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

GUISetFont (7, 400, 1, "Cambria Bold")
GuiCtrlCreateLabel("Ctrl+Alt+z for paste the text in another window" , 10, 10)

GUISetFont (9, 400, 1, "Cambria Bold Italic")
$Spaziotesto = GUICtrlCreateEdit("",10, 30, 290, 160, $ES_AUTOVSCROLL+$WS_VSCROLL)


GuiSetState()


; IDLE
While 1
    
    Global $testo = GUICtrlRead($Spaziotesto)
    sleep(300)

WEnd


Func Terminate()
    
Exit 0
    
EndFunc


Func paste()

    Send($testo)
    
EndFunc
Link to comment
Share on other sites

Yes it seems it does.. send ctrlup and altup after or before you send the copied data

#include <GuiConstants.au3>
#NoTrayIcon

Opt("GUIOnEventMode", 1)

;CheckPID()

HotKeySet("^!z", "paste")

GuiCreate("MacroPaste by Kurtferro", 310, 200)
WinSetOnTop("MacroPaste by Kurtferro", "", 1)
WinSetTrans("MacroPaste by Kurtferro", "", 245)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

GUISetFont (7, 400, 1, "Cambria Bold")
GuiCtrlCreateLabel("Ctrl+Alt+z for paste the text in another window" , 10, 10)

GUISetFont (9, 400, 1, "Cambria Bold Italic")
$Spaziotesto = GUICtrlCreateEdit("",10, 30, 290, 160, $ES_AUTOVSCROLL+$WS_VSCROLL)


GuiSetState()


; IDLE
While 1
    
    Global $testo = GUICtrlRead($Spaziotesto)
    
    sleep(300)

WEnd


Func Terminate()
    
Exit 0
    
EndFunc


Func paste()

    Send($testo)
    Send ("{CTRLUP}{ALTUP}")
    
EndFunc
Link to comment
Share on other sites

Yes it seems it does.. send ctrlup and altup after or before you send the copied data

#include <GuiConstants.au3>
#NoTrayIcon

Opt("GUIOnEventMode", 1)

;CheckPID()

HotKeySet("^!z", "paste")

GuiCreate("MacroPaste by Kurtferro", 310, 200)
WinSetOnTop("MacroPaste by Kurtferro", "", 1)
WinSetTrans("MacroPaste by Kurtferro", "", 245)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

GUISetFont (7, 400, 1, "Cambria Bold")
GuiCtrlCreateLabel("Ctrl+Alt+z for paste the text in another window" , 10, 10)

GUISetFont (9, 400, 1, "Cambria Bold Italic")
$Spaziotesto = GUICtrlCreateEdit("",10, 30, 290, 160, $ES_AUTOVSCROLL+$WS_VSCROLL)


GuiSetState()


; IDLE
While 1
    
    Global $testo = GUICtrlRead($Spaziotesto)
    
    sleep(300)

WEnd


Func Terminate()
    
Exit 0
    
EndFunc


Func paste()

    Send($testo)
    Send ("{CTRLUP}{ALTUP}")
    
EndFunc

tnx, but it's normal or it's a little bug?

In the help i dont seem there is written It takes so

Link to comment
Share on other sites

I have tried, the problem still persist.

Your original code I get teh sticky keys so to speak so I do ctrl alt Z and it copies the text then I only need to use the z key cos the other keys are stuck

When I add the line Send ("{CTRLUP}{ALTUP}") from my post I don't get the problem. I'm on XP sp2

Link to comment
Share on other sites

  • 3 weeks later...

AutoIt can't judge the intent. Maybe you really did mean to have those other keys down, maybe not. We don't know, but you do. So you must be the one to clear the modifier state if that's what you really need to do.

Note: I revived this because there is a bug report referencing this thread. I'm moving the bug report to the NO BUG sub-forum but I'm replying here since this is where all the discussion was.

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