sending emails..one at a time. gawd!

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

clate
Newbie
Posts: 11
Joined: Wed Nov 29, 2006 2:34 am

sending emails..one at a time. gawd!

Post by clate » Wed Nov 29, 2006 6:35 am

A request to all MS Gurus out there...Give me your best feedback or solution.

First off, i am just a sales guy and not a code guy, so even this code below took months of caveman configuring....and it still is not reliable.


summary of job: sales job to individuals.
restrictions: company says"no mass emails or blasting, but sending one at a time is fine."
the challenge:15000 customer records with email addresses inside a customer vb application and i want to let them know of our special quickly.

i built this script and it works...sometimes...grrrrrr! It just takes too damn long or it just doesnt send the email and I have over 50 new emails in my sys tray when I check it. Yeah..I know. I am over my head, but least I am tryin!

the vb application, we sales force use, has a "send email" button i activate with an LClick

the problem is the total script takes about 28 seconds to complete.
28 seconds * 15000=GOOD GOSH!
Is there a smarter way to write this code?
Is there a quicker way to send these emails?

Would it be better to Ctrl C the email addresss and then send emails thru a diiferent macro involving Outlook?


okay here it is...I welcome your input!



Code: Select all

(THIS IS THE NUMBER OF LOOPS)
Let>NumTimesToLoop=400 
Let>Counter=0 
Label>StartOfLoop 

//Recorded Events 
Let>WW_TIMEOUT=5 



Let>WW_TIMEOUT=5 
CapsOff 
MouseMove>38,406 
Let>RP_WAIT=1 
Wait>1 
LDblClick 
Let>RP_WAIT=1 
MouseMove>50,405 
Let>RP_WAIT=1 
Wait>1 
Press ALT 
Let>RP_WAIT=1 
Send>w 
Let>RP_WAIT=1 
Press Down 
Let>RP_WAIT=1 
Press Up 
Let>RP_WAIT=1 
Press Enter 
wait>1.2 
Let>RP_WAIT=1 
MouseMove>201,325 
Let>RP_WAIT=1 
wait>1.2 
LClick 
Let>RP_WAIT=1 
Send>ab 
Let>RP_WAIT=1 
Press Enter 
MouseMove>447,325 
Let>RP_WAIT=1 
LClick 
Let>RP_WAIT=1 
wait>1.2 
WaitWindowOpen>CUSTOM COMPANY APPLICATION- 3.3.36 
MoveWindow>CUSTOM COMPANY APPLICATION- 3.3.36,-4,-4 
ResizeWindow>CUSTOM COMPANY APPLICATION- 3.3.36,1032,742 
Let>RP_WAIT=1 
Let>RP_WAIT=2 
Press ALT 
WaitWindowOpen>Untitled Message 
MoveWindow>Untitled Message,54,76 
ResizeWindow>Untitled Message,906,564 
WaitWindowOpen>TaskSwitchXP Pro 2.0 
MoveWindow>TaskSwitchXP Pro 2.0,196,96 
ResizeWindow>TaskSwitchXP Pro 2.0,632,392 
Let>RP_WAIT=1 
wait>1.2 
Release ALT 
Let>RP_WAIT=1 
wait>2.2 
Press ALT 
Let>RP_WAIT=1 
WaitWindowOpen>CUSTOM COMPANY APPLICATION- 3.3.36 
MoveWindow>CUSTOM COMPANY APPLICATION- 3.3.36,-4,-4 
ResizeWindow>CUSTOM COMPANY APPLICATION- 3.3.36,1032,742 
WaitWindowOpen>TaskSwitchXP Pro 2.0 
MoveWindow>TaskSwitchXP Pro 2.0,196,96 
ResizeWindow>TaskSwitchXP Pro 2.0,632,392 
Let>RP_WAIT=1 





wait>1.2 
Release ALT 
Let>RP_WAIT=1 
Press CTRL 
Let>RP_WAIT=1 
Press ALT 
Let>RP_WAIT=1 
Release ALT 
Let>RP_WAIT=1 
Release CTRL 
Let>RP_WAIT=1 
Release Shift 
Let>RP_WAIT=1 

PRESS TAB 
Let>RP_WAIT=1 

Let>RP_WAIT=1 
Press ALT 
Let>RP_WAIT=1 
Let>RP_WAIT=1 
Send>i 
Let>RP_WAIT=2 
Release ALT 
Let>RP_WAIT=1 
Press Down 
Let>RP_WAIT=1 
Press Right 
Let>RP_WAIT=1 
Press Down * 6 
Let>RP_WAIT=1 
Press Right 
Let>RP_WAIT=1 
Press Down * 1 
Let>RP_WAIT=1 
Press Enter 
Let>RP_WAIT=1 
wait>1.2 
Let>RP_WAIT=1 


Let>RP_WAIT=1 
press shift 
Let>RP_WAIT=1 
press tab 
Let>RP_WAIT=1 
release shift 

Let>RP_WAIT=1 
Send>Your 2006 Special! 

Let>RP_WAIT=1 
Press Tab 
Let>RP_WAIT=1 


Let>RP_WAIT=1 
Press ALT 
Let>RP_WAIT=1 
Send>s 
Let>RP_WAIT=1 
Release ALT 
WaitWindowOpen>Untitled Message 
MoveWindow>Untitled Message,54,76 
ResizeWindow>Untitled Message,906,564 
Let>RP_WAIT=1 
MouseMove>222,469 
Let>RP_WAIT=1 
LClick 
Let>RP_WAIT=1 


(this is the disposition) 


Send>cnnnn 
Let>RP_WAIT=1 
Press Enter 
Let>RP_WAIT=1 
Press Tab 
Let>RP_WAIT=1 
(this the priority) 

Send>1 
Let>RP_WAIT=1 


Let>RP_WAIT=1 



MouseMove>451,510 
Let>RP_WAIT=1 
LClick 
Let>RP_WAIT=1 

Let>RP_WAIT=1 



Let>RP_WAIT=1 
MouseMove>460,481 
Let>RP_WAIT=1 
LClick 
Let>RP_WAIT=1 



Let>RP_WAIT=1 

MouseMove>912,62 
Wait>1 
Let>RP_WAIT=1 
LClick 
Let>RP_WAIT=1 

Let>RP_WAIT=1 

MouseMove>870,64 
Let>RP_WAIT=1 
LClick 
Let>RP_WAIT=1 


Let>RP_WAIT=1 


MouseMove>777,76 
Let>RP_WAIT=1 
Let>RP_WAIT=1 
Press ALT 
Let>RP_WAIT=1 
Send>w 
Let>RP_WAIT=1 
Press Down 
Let>RP_WAIT=1 
Press Up 
Let>RP_WAIT=1 
Press Enter 
Let>RP_WAIT=1 

Let>RP_WAIT=1 


MouseMove>442,274 
Let>RP_WAIT=1 
Let>RP_WAIT=1 
LClick 
Wait>0.87 
MouseMove>41,405 
Let>RP_WAIT=1 
Wait>1.0 
LClick 
Let>RP_WAIT=1 
MouseMove>64,387 
Let>RP_WAIT=1 



Add>Counter,1 
If>Counter=NumTimesToLoop,FinishLoop 
Goto>StartOfLoop 
Label>FinishLoop



Thanks guys!


C

[/code]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Nov 29, 2006 7:48 am

I have no time to read all of script right now, but RP_WAIT=1 is only needed just before using the command Run Program.

And will stay at that value until you do RP_WAIT=0

Why are you using RP_WAIT? What did you think it was going to do for you?
IF not needed you can remove all of those lines.

A quick scroll did not show any Run Program> command, so you could do a Search/Replace, searching for RP_WAIT=1 and replace it with nothing as a quick way of deleting those lines. that will also make the rest of the script easier to read.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Nov 29, 2006 8:20 am

Do you really need to automate another app just to send an email? Can you not just use the SMTPSendMail command?

Or you could manipulate Outlook using it's COM interface:
http://www.mjtnet.com/forum/viewtopic.php?t=611

Or use CDO:
http://www.mjtnet.com/forum/viewtopic.php?t=1663
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

clate
Newbie
Posts: 11
Joined: Wed Nov 29, 2006 2:34 am

Post by clate » Thu Nov 30, 2006 10:13 pm

Again..I have to apologize for the code mess. I am not a programmer I am a sales guy that has to use internal office GUI applications to retrieve my customer information.

On Bob's Q about why the RP_WAIT:....

well...i was using RP_WAIT as way to have the macro not proceed further until the previous task was finished.

As i was creating my script...sometimes the application would hourglass during commands even with WAIT>1 and the macro would continue and it would not complete all the tasks.

I started using RP_WAIT because I saw it in a script forum and it seemed to work and it seemed to cut down on the time of the entire loop. When I used ex: WAIT>1.5, sometimes it be too much time, where on the next loop it was not enough. I am totally open to using other code if there is someting better.

MTettmar's Q on SMTPSendMail

There are a few things on this:
1. As a sales guy...I have to retrieve the particular email address from the db GUI application. This application pulls up each customer detail account individually. Unfortunately, the department is not gracious enough to give me a spreadsheet of all the addresses. everythingis pulle dup one customer detail at a time.
So...I try to copy the email addr and then send an email individually while i am away from my desk. The GUI application has a "send email" button next to the email address field which i utilize in my macro by using a mouse move in my script.

As far as SMTP SENDMAIL. the IT dept keep all our email usrname and psswrds on file. I dont even know what it is other than my username.
we log in to our pcs and our email is connected.


Yeah ..I know I am coding caveman, but if can get this down, my productivity would explode.

I know for you guys this post must be painful to help on, but i certainly appreciate it.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Dec 01, 2006 3:44 am

How would you like to connect via GoToMeeting and let me just show you some good coding technique for automating your process. IF you own a copy of MacroScheduler...

Otherwise (eval only) we'll continue to help you "Caveman" your way through

:D

clate
Newbie
Posts: 11
Joined: Wed Nov 29, 2006 2:34 am

Post by clate » Mon Dec 04, 2006 3:09 pm

i would love that! and yes I am a customer!

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

email sender code

Post by kpassaur » Tue Jan 02, 2007 6:57 pm

I use this below to send emails. It allows the user to select a text file for the message and a file of email address. The email addresses should be one per line. It will work with most ISP as it randomly sends them out with a delay of between 1 to 10 seconds.

There are other ways such as mentioned above with outlook but I have had difficulty with them and this is very easy. However, if you elect to use the SMTP that is built into XP beware that some mail servers block mail from dynamic IP addresses. Anyway, just read the code, compile it and run it.

Code: Select all



APP_TITLE=Bulk Mail Sender
Iffileexists>c:\bulksendmail\bulksend.ini,readini,skipreadini

Label>skipreadini
Let>RP=
Let>Sub=
Let>frad=
Let>fname=
Let>Body=
Let>Pass=
Let>Uid=
Let>MS=
GoTo>menu
Label>readini
ReadIniFile>c:\bulksendmail\bulksend.ini,BulkSettings,RecipientPath,RP
ReadIniFile>c:\bulksendmail\bulksend.ini,BulkSettings,Subject,Sub
ReadIniFile>c:\bulksendmail\bulksend.ini,BulkSettings,fromadd,frad
ReadIniFile>c:\bulksendmail\bulksend.ini,BulkSettings,Fromname,fname
ReadIniFile>c:\bulksendmail\bulksend.ini,BulkSettings,ebodyfile,Body
ReadIniFile>c:\bulksendmail\bulksend.ini,BulkSettings,SMTPPASS,Pass
ReadIniFile>c:\bulksendmail\bulksend.ini,BulkSettings,smtpuid,Uid
ReadIniFile>c:\bulksendmail\bulksend.ini,BulkSettings,MailServer,MS

Label>menu
LibFunc>user32,GetSystemMetrics,screen_width,0
LibFunc>user32,GetSystemMetrics,screen_height,1
Let>width=700
Let>height=193
Let>left={(%screen_width% div 2) - (%width% div 2)}
Let>top={(%screen_height% div 2) - (%height% div 2)}

   /Top=263
   /Width=689
   /Left=156
   /Height=346


Dialog>Dialog1
   Caption=Bulk eMail Sender Setup
   Top=%top%
   Width=%width%
   Left=%left%
   Height=%height%
   Label=Text File of Addresses,24,44
   Label=eMail Body Text File,32,76
   Label=Bulk eMail Sender,272,16
   Edit=recipients,136,40,369,%RP%
   Edit=ebodyfile,136,72,369,%Body%
   Button=Exit,318,104,75,25,2
   Button=Browse to Address File,512,40,145,25,0,,One eMail Address on Each Line
   Button=Browse to eMail Text File,512,72,145,25,0,,Must be Plain ACSII Text File
   Button=Continue,223,104,82,25,5
   FileBrowse=Browse to Address File,recipients
   FileBrowse=Browse to eMail Text File,ebodyfile
EndDialog>Dialog1




Dialog>Dialog2
   Caption=Bulk eMail Sender Setup
   Top=236
   Width=587
   Left=208
   Height=282
   Label=Subject,40,44
   Label=From Address,16,76
   Label=From Name,248,76
   Label=SMTP Password,320,140
   Label=SMTP User ID,336,172
   Label=Bulk eMail Sender,224,16
   Label=Mail Server,24,124
   Edit=Subject,88,40,369,%Sub%
   Edit=fromadd,88,72,145,%frad%
   Edit=Fromname,312,72,145,%fname%
   CheckBox=authrequired,SMTP Authentication Reguired,320,112,177,True
   Edit=SMTPPASS,408,136,121,%Pass%
   Edit=smtpuid,408,168,121,%Uid%
   Button=Run,176,200,75,25,1
   Button=Exit,350,200,75,25,2
   Edit=MailServer,88,120,177,%MS%
   CheckBox=showstatus,Show Send Status Window,88,160,161,True
   Button=Save Changes,255,200,91,25,5
   FileBrowse=Browse to Address File,recipients
   FileBrowse=Browse to eMail Text File,ebodyfile
EndDialog>Dialog2



Label>MainLoop
Show>Dialog1,result
GetDialogAction>Dialog1,result
  If>result=2,finish
  If>result=5,Continue
Goto>MainLoop

Label>Continue
Let>recipients=%Dialog1.recipients%
Let>ebodyfile=%Dialog1.ebodyfile%


Label>MainLoop2
Show>Dialog2,result
  If>result=2,finish
  If>result=1,Sendit
  If>result=5,justsave
Goto>MainLoop2

Label>justsave
Let>skiprun=1

Label>Sendit
Let>Subject=%Dialog2.Subject%
Let>fromadd=%Dialog2.fromadd%
Let>Fromname=%Dialog2.Fromname%
Let>SMTPPASS=%Dialog2.SMTPPASS%
Let>smtpuid=%Dialog2.smtpuid%
Let>MailServer=%Dialog2.MailServer%

Let>fp=%one.fp%
	DeleteFile>c:\bulksendmail\bulksend.ini
	Let>Section2=[BulkSettings]
	WriteLn>c:\bulksendmail\bulksend.ini,%Section2%

	Let>z=RecipientPath=
	ConCat>z,%recipients%
	WriteLn>c:\bulksendmail\bulksend.ini,%z%

	Let>z=Subject=
	ConCat>z,%Subject%
	WriteLn>c:\bulksendmail\bulksend.ini,%z%

	Let>z=fromadd=
	ConCat>z,%fromadd%
	WriteLn>c:\bulksendmail\bulksend.ini,%z%

	Let>z=Fromname=
	ConCat>z,%Fromname%
	WriteLn>c:\bulksendmail\bulksend.ini,%z%

	Let>z=ebodyfile=
	ConCat>z,%ebodyfile%
	WriteLn>c:\bulksendmail\bulksend.ini,%z%

	Let>z=SMTPPASS=
	ConCat>z,%SMTPPASS%
	WriteLn>c:\bulksendmail\bulksend.ini,%z%

	Let>z=smtpuid=
	ConCat>z,%smtpuid%
	WriteLn>c:\bulksendmail\bulksend.ini,%z%
	
	Let>z=MailServer=
	ConCat>z,%MailServer%
	WriteLn>c:\bulksendmail\bulksend.ini,%z%
If>skiprun=1,finish
ReadFile>%ebodyfile%,body

Let>k=1
Label>start
ReadLn>%recipients%,k,recipientlists

If>recipientlists=##EOF##,finish
If>%Dialog1.authrequired%=True,Secure,notSecure
Label>Secure
Let>SMTP_AUTH=1
Let>SMTP_USERID=%smtpuid%
Let>SMTP_PASSWORD=%SMTPPASS%
Label>notSecure
Let>SENDMAIL_STATUS=1
SMTPSendMail>%recipientlists%,%MS%,%fromadd%,%Fromname%,%Subject%,body,

//MDL>SMTPSendMail>%recipientlists%,%MS%,%fromadd%,%Fromname%,%Subject%,body,
WriteLn>C:\bulksendmail\mailresults.txt,result,%recipientlists% - %SMTP_RESULT%

Let>k=k+1

Random>10,DiceResult

Wait>%DiceResult%
Goto>start
Label>finish


clate
Newbie
Posts: 11
Joined: Wed Nov 29, 2006 2:34 am

cool!

Post by clate » Wed Jan 10, 2007 1:39 am

Wow. cool thanks.

(trying it out)

okay...
I have all the criteria and entered it correctly....
When i run the script it sticks on " Resolving hostname 3. "
no email was sent

any insight on what this means???

and is there any way to alter your script to send the email?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

resolving hostname issue

Post by kpassaur » Wed Jan 10, 2007 1:58 am

I have never run into that issue. I would suggest that if you have xp professional that you use the mail server that comes with it. In no more that 15-20 minutes you will have figured it out. Just install !!S from your xp disk, go into it through the control panel and play with the settings.

I sent out about 6000 emails with it last week.

clate
Newbie
Posts: 11
Joined: Wed Nov 29, 2006 2:34 am

Post by clate » Fri Jan 12, 2007 11:09 pm

kpass,

Thanks for the input!

Well...I ran your macro at work and they use a scalix server, so that may be the issue. on why i get it to work right. I have no choice, but to run this from work...so (sigh)...back to trying to find a solution...

and as far as using the other mail server..i have xp pro here at work (corp enviroment), but I have no discs and i am not quite sure how to wlk thru what you are talking about....unless you have any other sources for what you are mentioning....



Hey Bob Hansen!

I use Let>RP_WAIT=1 to prevent the command from moving forward until it has caught up since the wait time can change.

I found it ran pretty quickly with this line ...Let>RP_WAIT=1

Is there a better command to use other than WAIT>1???

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Mail Server on XP

Post by kpassaur » Fri Jan 12, 2007 11:19 pm

You need to have IIS installed. You can check in the Control Panel under Windows Components. If it is installed you open up IIS and go to SMTP. The options are rather simple you grant access to Relay from the computer you are on . It has a DNS lookup so you can just type in your computer name and it will set the IP address. Should take about 30 minutes if you don't know what you are doing. Less than five once you have done it a couple of times.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Jan 12, 2007 11:50 pm

Wait>n and RP_WAIT variable perform totally different functions.

Wait>n just forces a delay of n seconds then allows the script to continue.

Wait>n can take any almost any value, and can be made equal to a variable.
Recorded macros are filled with Wait> lines that can be deleted in many instances. Wait is usually useful to help fine tune race conditions in a computer system.
Usually helpful with CTL/ALT key combos, like Press ALT, Wait>.2 Press c,Wait>.2, Release ALT.

RP_WAIT is a delay that is used with the Run Program command. But the delay is not time based, but based on completion of a program.
When Run Program is run, the script will continue to run immediately while the called program is running if RP_WAIT=0. But if RP_WAIT=1, then the script will stop running until the called program has been closed.

Once RP_WAIT is set in a script, it will retain that value until script ends or until it gets a command to change its value. So it can be set at beginning of script if always going to be the same value. No need to run it before every Run Program command. Only takes a value of 1 or 0 (default).
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

clate
Newbie
Posts: 11
Joined: Wed Nov 29, 2006 2:34 am

Post by clate » Tue Jan 16, 2007 12:50 am

So...
I have script that loops for a certain amount of times and has... let's say for example a command...

"Press Enter"

and the application that I am using the macro script on tends to hourglass and stall once the "Press Enter" command has been given. The hourglass or stall time is variable for every different time it repeats the loop.

Is there a better way to prevent the script from moving forward and keeping the macro optimal for time efficency?

I found that the WAIT> command is too fixed. I am either giving the script not enough time or too much and when i give the script too much time it stretches the time execution of the script itself to where its not efficent enough.

Since this script will run over 10000 times in a row, I am looking for a command that will signal to the script to continue once the application has stop hourglassing caught up.

Any ideas?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Jan 16, 2007 3:46 am

Hello Clate.

You have only submitted one script at the start of this thread. I may have missed it, but I don't see any RunProgram command. So, if you have not RunProgram command, you don't need RP_WAIT=1, it will do nothing.

You can cause your script to wait using a number of methods. When you are running the routine manually, what do you wait for before you continue with the next mouse/keyboard action? That is the same tool you should use here to control the speed.

Some options are WaitWindowOpen, IfFileExists, INI value, registry value, Pop Up Message Window, Color change, Text Change, length of a string, etc.

The solution from kpassaur has no RP_WAIT, and only has one Wait command that varies to a max of 10 seconds. Have you tried modifying his code to work in your environment?

If you provide your script and explain where you need the delays, where does the hourglass appear. There are many options that we can provide as a solution.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Fri May 28, 2010 6:14 pm

restrictions: company says"no mass emails or blasting, but sending one at a time is fine."
Just a thought here......

If you automate the email process to send to thousands of people, then this is THE definition of "mass email" or "blasting".


Hope you didn't get in trouble for this :roll:

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts