Page 1 of 1

I need help making a script!

Posted: 21 Sep 2017, 21:02
by SparksTheDarks
I need help making a script that holds SHIFT&W and taps CTRL&V!
I would also like the enable key to be F1!

Re: I need help making a script!

Posted: 21 Sep 2017, 22:17
by Exaskryz
Have you checked the Tutorial?

F1 will be your Hotkey. If you'd like to disable it (end when it's holding Shift and W), check out doing a toggle. This will also show you how to tap the Ctrl+V (Send ^v): (Note: The first link is from the old forums, the second link is on these forums) http://www.autohotkey.com/board/topic/6 ... re-thread/ or https://autohotkey.com/boards/viewtopic.php?f=7&t=11952

To hold down a key, specify the key name and the down state like this in the Send command: Send {w down}. Shift would be Send {shift down}. Notably, you miiight be able to get away with using Send {W down} as you need shift to produce a capital W most of the time (unless CapsLock is on), but whatever your target program is may not recognize Shift and W are down. Now I will note that if you have Shift held down, AHK will keep it down even when you do Ctrl+V, resulting in a final key combination of Shift+Ctrl+V which you may not want. So you may need to release Shift before you press Ctrl+V. You can release a held down key with Send {Shift up} -- change the down to up. You might be able to use Send {Shift DownTemp} (see the documentation on Send), but it may release Shift when you try to hold down the W key. I'll be exploring it myself to see if I can get it to work.

Edit: I couldn't manage to utilize the {Shift Downtemp}, because once you call any key after it, Shift is released and never pressed down again. So you may as well do a manual release. Whenever you call for Ctrl+V, release Shift and put it back down like this: Send {Shift up}^v{Shift down}. This may not be perfect though depending on your use case and implementation.

Someone will hopefully correct me if there is a better way to accomplish what you like, assuming Shift+Ctrl+V is undesirable for you.

Edit 2:

One thing I forgot to mention is you may need to make your hotkey use the * modifier. If F1 makes Shift hold down, then that means even your physical presses will act like Shift is held down. Which means pressing F1 physically appears to be Shift+F1 to the script, and it won't activate an F1:: hotkey. The * gets around that by saying "Any or no modifiers may be pressed to activate this hotkey", so Shift+F1 and F1 alone activate an *F1:: hotkey.

Re: I need help making a script!

Posted: 21 Sep 2017, 23:45
by BoBo
Exaskryz wrote:Have you checked the Tutorial?

F1 will be your Hotkey. If you'd like to disable it (end when it's holding Shift and W), check out doing a toggle. This will also show you how to tap the Ctrl+V (Send ^v): (Note: The first link is from the old forums, the second link is on these forums) http://www.autohotkey.com/board/topic/6 ... re-thread/ or https://autohotkey.com/boards/viewtopic.php?f=7&t=11952

To hold down a key, specify the key name and the down state like this in the Send command: Send {w down}. Shift would be Send {shift down}. Notably, you miiight be able to get away with using Send {W down} as you need shift to produce a capital W most of the time (unless CapsLock is on), but whatever your target program is may not recognize Shift and W are down. Now I will note that if you have Shift held down, AHK will keep it down even when you do Ctrl+V, resulting in a final key combination of Shift+Ctrl+V which you may not want. So you may need to release Shift before you press Ctrl+V. You can release a held down key with Send {Shift up} -- change the down to up. You might be able to use Send {Shift DownTemp} (see the documentation on Send), but it may release Shift when you try to hold down the W key. I'll be exploring it myself to see if I can get it to work.

Edit: I couldn't manage to utilize the {Shift Downtemp}, because once you call any key after it, Shift is released and never pressed down again. So you may as well do a manual release. Whenever you call for Ctrl+V, release Shift and put it back down like this: Send {Shift up}^v{Shift down}. This may not be perfect though depending on your use case and implementation.

Someone will hopefully correct me if there is a better way to accomplish what you like, assuming Shift+Ctrl+V is undesirable for you.
Holy SHIFT! I should let you rewrite the manuals for all of my home devices :lol: :thumbup: