Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Little help for a newb please


  • Please log in to reply
3 replies to this topic
rick12345
  • Members
  • 1 posts
  • Last active: Nov 01 2015 10:45 PM
  • Joined: 01 Nov 2015
Hello guys i just installed autohotkey and read the basic tutorial but i cannot make my script work. What i want to do is simply send one keybind to a specific program running in the background. I came up with this: WinGet, Client_tos1d Loop { ControlSend, z, ahk_id %Client_tos1d1% Sleep 500 } But its not working... Can someone give me a little help please?

Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

Your code didn't get formatted right. Anyhow, I notice on your ControlSend that you are specifying that "z" should be the targeted Control and that you would like to send the keystrokes "ahk_id %Client_tos1d1%". If you want to omit the Control parameter, use two commas to mark the beginning and ending of that parameter.



maxpaynex
  • Members
  • 1 posts
  • Last active: Nov 04 2015 06:40 PM
  • Joined: 02 Nov 2015

I'm sorry i'm a noob too, i want to start a topic but i get "You cannot start a new topic" ..so i can't post my question anywhere.

 

 

Basically, want to press and hold {A} to perform 3 things:

press button {X} only once at the start
then hold button {1} untill i release {A}
then press {X} again at the release

so when i hold the button {A} , then release it after a while, it will look like this X11111111111111111111111111111111111111111X

Can someone plz help me with a script, i cant get mine to work. All i could come up with is this

 

A::Send X
KeyWait, A
A Up::Send X
Return

 

I don't know how to integrate in the script the part that will repeatedly press 1 before the fist X and last X. The script is for swapping weapons in a game then using repeatedly a skill before swapping back.



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

FYI, no one can start a topic on these forums. These are considered the old forums which are in the middle of shutting down. It's great that you have questions, and I encourage you post them at autohotkey.com/boards/ (note the old forum is "/board/" while the new one is "/boards"/).

 

So your code here has a few things wrong with it.

 

A::Send X
KeyWait, A
A Up::Send X
Return

 

You have two single-line hotkeys. The KeyWait, A and Return lines are never executed. (However, single-lines have an implicit return associated with them.)

 

So we should fix your initial code to this, by eliminating the A Up hotkey (the KeyWait is performing that function), and moving your first Send X to a line below the A hotkey.

 

A::
Send x ; note that a capital X in the Send command is processed as Shift+X which may be undesirable in a game
KeyWait, A
Send x
return

 

To implement hold 1 and releasing it when you release A, you will need to know that you can send a key into a down position by putting the key name in brackets and including the keyword "down". Releasing it is done by using the keyword "up". Example: Send {1 down} will put the 1 into a down state. Do note that if this is not being done in a game, it is likely you will only see a single "1" keystroke and not many such as 11111111. This is because your keyboard driver is responsible for the many 1s when you hold down the 1 key physically; AHK bypasses the keyboard driver.

 

A::
Send x ; note that a capital X in the Send command is processed as Shift+X which may be undesirable in a game
Send {1 down}
KeyWait, A
Send {1 up}
Send x
return

 

If you would like, the consecutive Sends can be put on the same line:

 

A::
Send x{1 down}
KeyWait, A
Send {1 up}x
return

 

Note that I didn't put any spaces between the x and brackets because then AHK would send a space key as well.