Sign in to follow this  
Followers 0
noto1611

HotKeySet overwriting other hotkeys

4 posts in this topic

Hello all,

Ive got the following problem:

I want my macro to scroll through an array when i press ctrl + v, and put the strings from the array into the clip.

So basicaly each time I press ctrl + v (paste) it pastes the next string in the array.( Paste -> pastes string 1.. Paste -> pastes string 2 ... Paste -> pastes string 3... and so on.)

This is what I have written:

HotKeySet("^v", "Scrollpaste")
Func Scrollpaste()
    
    if $scrollcounter >= 7 Then; (Array has got 8 strings)
        $scrollcounter = 0
    Else
        $scrollcounter = $scrollcounter + 1
    EndIf

    ClipPut ($msg[$scrollcounter])

EndFunc

This is what it does: It pastes nothing, because Autoit seems to "overwrite" the pasting and does the defined function instead.

Now you may ask why I dont write a Send() command into the function that simulates ctrl + v. Well, the answer is easy: The macro is used for a application that blocks inputs simulated by macros/autoIt.

Also, if I set the hotkey to "v", autoit ignores it because im actually pressing ctrl + v and not v only.

Please help me :& how could i make this work?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Be carefull not to tap the keys too fast.

#include <Misc.au3>

Global $i = 0, $string[8]

$string[0] = "String1"
$string[1] = "String2"
$string[2] = "String3"
$string[3] = ""
$string[4] = ""
$string[5] = ""
$string[6] = ""
$string[7] = ""

ClipPut($string[0])

While 1
    If _IsPressed(56) AND _IsPressed(11) Then
        onpaste()
        While _IsPressed(56) AND _IsPressed(11)
            Sleep(5)
        WEnd
    Else
        Sleep(20)
    EndIf
WEnd

Func onpaste()
    $i += 1
    If $i = 8 Then
        Exit
    EndIf
    ClipPut($string[$i])
EndFunc
Edited by Manadar

Share this post


Link to post
Share on other sites

Yeah! its working now. Thanks alot :P

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