Sign in to follow this  
Followers 0
dazzyreil

Controlsend An E-mail

4 posts in this topic

#1 ·  Posted (edited)

Hi,

I'm trying to make a script that uses control send to send an e-mail with the outlook window hidden.

$text = "hi"
run("C:\Program Files\Outlook Express\msimn.exe", "", @SW_HIDE)
sleep(5000)
ControlFocus("Inbox - Outlook Express", "", "Outlook Express Browser Class")
sleep(250)
ControlSend("Inbox - Outlook Express", "", "Outlook Express Browser Class", "!f")
sleep(500)
ControlSend("Inbox - Outlook Express", "", "Outlook Express Browser Class", "n")
sleep(500)
ControlSend("Inbox - Outlook Express", "", "Outlook Express Browser Class", "m")
sleep(1000)

ControlFocus("New Message", "", "ATH_Note")
sleep(500)
ControlSend("New Message", "", "ATH_Note", "dazzyreil@hotmail.com{tab}{tab}test{tab}")
sleep(500)
ControlSend("New Message", "", "ATH_Note", $text )
sleep(500)
ControlSend("New Message", "", "ATH_Note", "!s")

this doesnt work.

i read in the help file that control send doesnt work good with ALT keys.

can anybody help me with this script ??

Edited by dazzyreil

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

works fine for me, but you need a bit of adjustment.

$text = "hi"
AutoItSetOption("WinTitleMatchMode", 2);2 = Match any substring in the title
AutoItSetOption("WinDetectHiddenText", 1);1 = Detect hidden text
run("C:\Program Files\Outlook Express\msimn.exe", "",@SW_HIDE)
sleep(5000)

ControlFocus("Outlook Express", "Folders", "")
sleep(250)
ControlSend("Outlook Express", "Folders", "", "!f")
sleep(500)
ControlSend("Outlook Express", "Folders", "", "n")
sleep(500)
ControlSend("Outlook Express", "Folders", "", "m")
sleep(1000)


ControlFocus("New Message", "", "")
sleep(500)
ControlSend("New Message", "", "RichEdit20W2", "dazzyreil@hotmail.com")
ControlSend("New Message", "", "Internet Explorer_Server1",$text)
ControlSend("New Message", "", "RichEdit20W4", "test"); type subject last
ControlSend("test", "", "", "!s"); window title is subject

Outlook Express Browser Class is not a valid control.

when you fill in the subject, the window title changes to that subject, so type it in last.

Test it first without the @sw_hide and make sure it is working, then do @sw_minimise, and finally hide it.

ps, there are a lot of other ways to send email.

...edit one last thing. Outlook and Outlook Express are different. I know you meant outlook express however.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

thx for the code scriptkitty :huh2:

it works :D


Share this post


Link to post
Share on other sites

Just make sure to close that hidden Outlook window


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0