Need help on GMail Script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Flabsie

Need help on GMail Script

25 May 2017, 14:31

Hey everyone

I'm a new user of Autohotkey, and I'm trying to get my second script to work, but I get a very strange problem. Please bear with me as I try to explain it as clear as I can. :)

The situation: I plan on using this script to send a particular e-mail out to multiple people, one by one. So I have a set up where I have my GMail in Google Chrome, and another tab with the Online spreadsheet from which I need to retrieve the e-mail addresses. Here's what I do:

I manually insert the first e-mail address and subject, that's fine.

What I want to put in the script:
- Copy the body of the e-mail, I suppose this body should just be written out in the AHK script
- Ctrl+enter, which is the GMail hotkey for 'Send mail'
- ctrl+tab to go to the spreadsheet tab
- move down one cell (to get to the next e-mail address)
- ctrl+c
- ctrl+tab to go back to the GMail tab
- 'c' which is a GMail hotkey to compose a new message
- ctrl+v to copy the e-mail address in the recipient box
- Tab to move on to the subject box
- "The subject" as text
- "Hi" [SPACE]

So from there, I can once more manually type the person's name and repeat the script. Does that make any sense?

This is what my script looks like right now:

Code: Select all

+F6::
Send, The body of text in my mail
Send, A hyperlink
Send, More text in the mail
Send, Best regards
Send, My name
Send, ^{ENTER} ;Send the mail
Send, ^{TAB} ;Move to excel sheet
Send, {DOWN} ;Move one cell down
Send, ^c ;copy the cell content
Send, ^{TAB} ;Move to Gmail Sheet, because there are only 2 sheets active, this works
Send, c ;GMail hotkey for composing a new message
Send, ^v ;paste the cell content in recipient box
Send, {TAB} ;To move to the subject box
Send, I write the subject line here
Send, {TAB} ;To move to the text box
Send, Hi
If all went well, this would leave me with a filled in recipient box, subject box and a text box starting with Hi.. From where I can add the name of the person and run the script again.

The current result when I do this: Nothing! Absolutely nothing happens. I've can't even compile the script, let alone get it to run. When I try to compile it, I get: Error: could not copy final compiled binary file to destination.

So, any suggestions on getting my script to run and feetback on whether its written well, would be great!


Thanks in advance everyone!
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Need help on GMail Script

25 May 2017, 14:51

So I have a set up where I have my GMail in Google Chrome, and another tab with the Online spreadsheet from which I need to retrieve the e-mail addresses.
1) try to extract/download those email addresses beforehand and let AHK process them from a local copy.
2) frontend related activity (especially on web pages) are not that reliable. Therefore you should have a look at several available scripts that send email using AHK's COM functionality.
Flabsie

Re: Need help on GMail Script

26 May 2017, 04:39

Mucked about with the code for a bit longer, the first part works just fine. However, it goes wrong in the 5 last lines of the script. I've explained the situation below the code box :)

Code: Select all

+F6::
Send, {Enter}
Send, {Enter}
Send, {Enter}
Send, Mail part 1 
Send, {Enter}
Send, {Enter}
Send, Mail part 2
Send, {Enter}
Send, {Enter}
Send, Mail part 3 
Send, {Enter}
Send, {Enter}
Send, hyperlink
Send, {Enter}
Send, {Enter}
Send, Mail part 4
Send, {Enter}
Send, {Enter}
Send, {Enter}
Send, {Enter}
Send, Best regards
Send, {Enter}
Send, My name
Send, {Up 8} ;this is done to reach the hyperlink
Send, {Shift down}{Left 17} ;done to select the hyperlink
Send, {Shift up} 
Send, ^k ;done to create the hyperlink (=GMail hotkey combination)
Send, ^{ENTER} ;Send the mail
Send, ^{TAB} ;Move to excel sheet
Send, {DOWN} ;Move one cell down
Send, ^c ;copy the cell content
Send, ^{TAB} ;Move to Gmail Sheet, because there are only 2 sheets active, this works
Send, c ;GMail hotkey for composing a new message
Send, ^v ;paste the cell content in recipient box => THIS IS WHERE IT GOES WRONG!
Send, {TAB} ;To move to the subject box
Send, Inplannen Clarity Call
Send, {TAB} ;To move to the text box
Send, Hi
The red part is where it messes up. Instead of pasting the copied address, it starts writing (part of) the subject line in the recipient box. Perhaps the script is going too fast? Could I fix this with a Sleep command, and how would one do this exactly?
The address is successfully copied to the clipboard though, because a manual ctrl+v pastes the correct address.
Guest

Re: Need help on GMail Script

27 May 2017, 11:00

Can I bump this? :') Anyone who could help me out on the last 5 lines of code?

Thanks!
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Need help on GMail Script

27 May 2017, 11:51

Guest wrote:Can I bump this? :') Anyone who could help me out on the last 5 lines of code?

Thanks!
You've already realized that any performance issues will endanger your scripts processing flow.
That's the consequence of using less reliable methods - those that shouldn't be used if timing becomes an issue.

Download your/that address list.
Parse the addresses from that list to hand it over to an AHK COM-driven mail sending process.
No manual interference. Less timing issues. More reliable. More support(ers).

Good luck :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 242 guests