Jump to content

Recommended Posts

Posted

Dear developers and creators of the language, please explain to me why when pressing the combination Crtl + Shift + C from the 5th or the 10th time "sticks / sinks" Ctrl or Shift? And then you need to press Ctrl or Shift again to reset their triggering. I only need to use hot keys like in the example!

The code is a small example. Its essence is that when a user in the editor selects any number and presses a combination, then it increases by 1. 

Dim $x

HotKeySet("+^c","Calc")

While 1
    Sleep(10000)
WEnd

Func Calc()
    Send("^c")
    Sleep(50)
    $x=ClipGet()+1
    ClipPut($x)
    Send("^v")
EndFunc

I thought that in my program some kind of glitch was searching for a reason for a long time. And it turned out that apparently somehow the work of some functions used in the example is not compatible. 

Tell me, please, what is the problem?

Posted

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

I am very grateful for such a fast response, BrewManNH!
Tell me whether I have added my code correctly so that there is no stucking of the keys?

#include <Misc.au3>
Dim $x

HotKeySet("+^c","Calc")

While 1
    Sleep(10000)
WEnd

Func Calc()
    Send("^c")
    Sleep(50)
    $x=ClipGet()+1
    ClipPut($x)
    _SendEx("^v")
EndFunc

Func _SendEx($ss)
    While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12")
        Sleep(50)
    WEnd
    Send($ss)
EndFunc;==>_SendEx

And I have a combination with Ctrl and Shift! Maybe I do not like this solution and need to somehow change the function _SendEx? As I understand it, the function waits for a single key to be released, and I probably need to have both Ctrl and Shift. Or I do not need to change _SendEx function? 

Maybe in my case I need to use the following condition?

While _IsPressed("10") And _IsPressed("11")

 

Edited by AndreyS

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
×
×
  • Create New...