newbie ... SEND help

Get help with using AutoHotkey and its commands and hotkeys
rf78801
Posts: 3
Joined: 25 Jan 2020, 12:58

newbie ... SEND help

25 Jan 2020, 13:37

Greetings. Up front, I'm not a programmer, most of what I've read here is Greek to me.

That said, what I want to do is simple (I hope) ... I'm tired of entering my email address dozens of times per day and hope to be able to define a hotkey that does it for me.

I've gotten as far as opening a text editor and saving a file as an .ahk ... then I started researching the SEND command and realized I wasn't up to the task and needed help.

So, is there anyone out there that has already done something similar who is willing to provide an example?

Of course, after I have the syntax I will want to know how it is turned into an executable and how that executable is assigned to a key sequence (e.g. Alt+/ ... if that's a viable combo).

Thanks for any assistance you might be able to offer.
scriptor2016
Posts: 646
Joined: 21 Dec 2015, 02:34

Re: newbie ... SEND help

25 Jan 2020, 20:19

first you need to install the latest version of AHK (that is, if you haven't yet done so)

then, copy and paste the following code into an empty notepad document and save it as "myemailscript.ahk"

next, run the script you just saved

go into your email page, and left click in the field where you would normally type your email address, but instead of typing your address, just hold down SHIFT and then press x at the same time.

That should do it. You'll obviously need to change the email address in this script so it's your own.

Code: Select all

 +x::
sendinput, [email protected]
return
rf78801
Posts: 3
Joined: 25 Jan 2020, 12:58

Re: newbie ... SEND help

25 Jan 2020, 21:13

Amazing! Works great, thank you so very much. Just thinking of all the time and frustration you just saved me. :D
scriptor2016
Posts: 646
Joined: 21 Dec 2015, 02:34

Re: newbie ... SEND help

25 Jan 2020, 22:18

..you can change the SHIFT+x to any other key... for example you could change it to CAPSLOCK instead, assuming you don't really ever use that key.

So it would be:

Code: Select all

Capslock::
sendinput, [email protected]
return
so now all you have to do is press the one key instead of holding down two keys. The only problem here is that CAPSLOCK will not be able to carry out its normal function without some (minor) additional coding - you could look into that down the line if you're interested at that point :)
rf78801
Posts: 3
Joined: 25 Jan 2020, 12:58

Re: newbie ... SEND help

30 Jan 2020, 18:16

Big Smile ... it didn't take me too long to figure out I didn't have a capitol x anymore! Now I'm trying to learn the syntax for all the keys (cntl, fn, win, alt, etc...), it's fun learning. Thanks again.
scriptor2016
Posts: 646
Joined: 21 Dec 2015, 02:34

Re: newbie ... SEND help

30 Jan 2020, 23:56

Well, you do indeed still have a capital X whenever you want it. You can program your code so that pressing SHIFT+X will send your email address *only* in your browser window when you are entering your email. Pressing SHIFT+X in any other software will act as normal. Here's en example:

Code: Select all

#IfWinActive, ahk_class Chrome_WidgetWin_1 ;"Chrome_WidgetWin_1" is the Class Name for Google Chrome. This is obtained using Window Spy which is packaged with AHK when you downloaded and installed it
+X:: ;this is the hotkey for SHIFT+X
sendinput, [email protected]
Return
So what the above code does is that whenever you press SHIFT+X inside of Google Chrome, it will type out your email address for you. Just be sure that your cursor is activated inside the field where you enter the address as if you were manually typing it in. If you press SHIFT+X anywhere other than inside Google Chrome, it will send a Capital X as normal.

As for the key names and their variations,
this should help:

https://www.autohotkey.com/docs/KeyList.htm

Return to “Ask For Help”

Who is online

Users browsing this forum: afe, AHKStudent, Bing [Bot], c7aesa7r, Google [Bot], Green and 169 guests