Sign in to follow this  
Followers 0
xcxooxl

problem with HotKeySet..

5 posts in this topic

#1 ·  Posted (edited)

im trying to make a program that will press on a key when i hold ctrl and press another key

when i leave ctrl..

thats the code.. for some reason it doesnt work =/ any idea?

Global $Paused
HotKeySet("{ctrldown}", "DA" )
HotKeySet("{ctrlup}", "DB")

While 1
    Sleep(100)
WEnd

Func DB()
    Send( "{HOME}" )
    Send( "{HOME}" )
    Send( "{HOME}" )
    Send( "{HOME}" )
    Send( "{HOME}" )
    Send( "{HOME}" )
EndFunc

Func DA()
    Send( "{INSERT}" )
    Send( "{INSERT}" )
    Send( "{INSERT}" )
    Send( "{INSERT}" )
    Send( "{INSERT}" )
    Send( "{INSERT}" )
EndFunc
Edited by xcxooxl

Share this post


Link to post
Share on other sites



Just to make sure I understand: You want a program that activates the first function when you press ctrl + B, and then a different function if you just press B?

The reason your code isn't working is that ctrldown and ctrlup are not actually keychecks, they are key commands. Ctrldown tells the computer to hold down the ctrl key until ctrlup is sent, so it won't work for your hotkey.

Try this instead:

HotkeySet("^B", "DA") ;this one is ctrl + the B key.

HotkeySet("B", "DB") ;this one is just the B key.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

im trying to make a program that will press on a key when i hold ctrl and press another key

when i leave ctrl..

thats the code.. for some reason it doesnt work =/ any idea?

Global $Paused
HotKeySet("{ctrldown}", "DA" )
HotKeySet("{ctrlup}", "DB")

While 1
    Sleep(100)
WEnd

Func DB()
    Send( "{HOME}" )
    Send( "{HOME}" )
    Send( "{HOME}" )
    Send( "{HOME}" )
    Send( "{HOME}" )
    Send( "{HOME}" )
EndFunc

Func DA()
    Send( "{INSERT}" )
    Send( "{INSERT}" )
    Send( "{INSERT}" )
    Send( "{INSERT}" )
    Send( "{INSERT}" )
    Send( "{INSERT}" )
EndFunc

Look in the help file for HotkeySet and you will find a list of keys that can not be used.

Click here for a possible solution I posted earlier

Bowmore

Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

first i want to say i want that when i hold ctrl it will press on somthing

and when i leave ctrl it will press somthing else

and Bowmore i visited in the topic you posted here..

and i saw this code

While _IsPressed("46")

Sleep(100)

WEnd

46 suppose to be the key of somthing right?

then whats the key of ctrl?

and where can i get list of numbers and keys?

and 1 more thing..

while _Ispressd suppose to make an action while a key is pressed

but i need an action that after i done pressing ctrl it will press somthing else

how can i do that ?

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