Cant open new outlook email with Ctrl N

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Cant open new outlook email with Ctrl N

Post by Esabik » Thu Jan 09, 2014 7:28 pm

Hi

Can someone explain to me why I can do ctrl N when there is focus on microsoft outlook manually and it opens a new email, but if i use scripting, the new email window never opens and focus comes off microsoft outlook???
:roll:
Please see my sample below:

Let>filename=C:\Program Files\Microsoft Office\Office10\outlook.exe
Wait>.3
ExecuteFile>filename
WaitWindowOpen>Microsoft Outlook
wait>.2
setfocus>Microsoft Outlook
wait>2
press LCTRL
wait>.2
SendText>N
wait.2
Release LCTRL
//this times out as well
waitwindowopen>Untitled Message - Microsoft Word -*
setfocus>Untitled Message - Microsoft Word
wait>3
//TO: [email protected]
SendText>[email protected]
Just when you thought it was safe to go in the water........:evil:

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Jan 09, 2014 8:33 pm

I don't use Outlook so I can't test this. What happens if you use a lower case "n"?

SendText>n

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Post by Esabik » Thu Jan 09, 2014 8:46 pm

JRL wrote:I don't use Outlook so I can't test this. What happens if you use a lower case "n"?

SendText>n
either way nothing.... Tried all variations I could think of.....

Thanks :shock:
Just when you thought it was safe to go in the water........:evil:

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Jan 09, 2014 8:56 pm

Other thoughts:

use
Press CTRL
rather than
Press LCTRL

from Microsoft
Try
Press CTRL
Press Shift
Send>m
Release Shift
Release CTRL

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Post by Esabik » Thu Jan 09, 2014 9:23 pm

JRL wrote:Other thoughts:

use
Press CTRL
rather than
Press LCTRL

from Microsoft
Try
Press CTRL
Press Shift
Send>m
Release Shift
Release CTRL


Ok I did try this and got it to work, but I also got the CTRL N to work finally as well but I had to rem the Setfocus line after the waitwindow open for Microsoft outlook. Now it opened a new email just fine both ways. For some reason setfocus doesn't focus in a way that the scripting is appreciating... Isn't it better to use Setfocus on the windows??

WaitWindowOpen>Microsoft Outlook
wait>2
//setfocus>Microsoft Outlook
wait>2
press LCTRL
wait>.2
SendText>n
wait.2
Release LCTRL
wait>1
waitwindowopen>Untitled Message - Microsoft Word
//setfocus>Untitled Message - Microsoft Word
wait>1

p.s. had no problem with ALT S to send

Regards
Just when you thought it was safe to go in the water........:evil:

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Fri Jan 10, 2014 12:29 am

Yes you need to set focus to the window first, don't always assume that it has focus, had issues with Outlook previously with a similar issue.

Also when sending a command to a window always use the lower case letter.

One other thing, something I used to streamline things is to use mailto:

Example Below

Code: Select all

Let>INPUT_BROWSE=0
Input>EmailAddress,Please Enter The Email Address,[email protected]
Input>Subject,Please Enter The Email Subject,Test Script Example
Exe>mailto:%EmailAddress%?subject=%Subject%
FIREFIGHTER

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Post by Esabik » Fri Jan 10, 2014 1:51 pm

CyberCitizen wrote:Yes you need to set focus to the window first, don't always assume that it has focus, had issues with Outlook previously with a similar issue.

Also when sending a command to a window always use the lower case letter.
Cyber thats the problem with setfocus, it's not working to allow me to open the new email after outlook opens. If I open outlook and do nothing else except ctrl n it will initiate a new email message, but if I setfocus after outlook opens, then ctrl n will not work. So somehow the setfocus is focusing but it's not. Maybe we can share a session, as seeing is believing......
Just when you thought it was safe to go in the water........:evil:

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Sun Jan 12, 2014 7:48 am

I think this is the same issue I was seeing when I was trying to generate a new email and that's why I went to executing a mailto: request instead. You can also include the subject and body in the mailto:
FIREFIGHTER

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

Post by Marcus Tettmar » Mon Jan 13, 2014 2:57 pm

SetFocus will give you an error if no matching window is found.

If you are not getting an error then it must be finding a match.

But if keystrokes aren't landing then the wrong window is focused.

Therefore there must be a hidden window or some other window that your SetFocus is finding and it's not activating the one you think it is.

Try narrowing things down and specifying visible windows only by setting WF_TYPE accordingly.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Post by Esabik » Mon Jan 13, 2014 4:55 pm

Marcus Tettmar wrote:SetFocus will give you an error if no matching window is found.

If you are not getting an error then it must be finding a match.

But if keystrokes aren't landing then the wrong window is focused.

Therefore there must be a hidden window or some other window that your SetFocus is finding and it's not activating the one you think it is.

Try narrowing things down and specifying visible windows only by setting WF_TYPE accordingly.
I checked again with the screens and made a change to the application name in my script. This time around it is working with the setfocus. Instead of setting focus on microsoft outlook I changed it to Inbox - Microsoft outlook. I had tried that out the gate, but it timed out. Now it appears it finds the window and takes the commands from the script.

Let>filename=C:\Program Files\Microsoft Office\Office10\outlook.exe
//Let>filename_1=c:\Temp\MacolaAdjust\2013\macolaAdjust.txt
Let>filename_1=c:\Temp\MacolaAdjust\2013\Adjusttime.txt
Wait>.3
//Start outlook
ExecuteFile>filename
WaitWindowOpen>Inbox - Microsoft Outlook
wait>2
//Start notepad
ExecuteFile>filename_1
WaitWindowOpen>Adjusttime.txt - Notepad
setfocus>Adjusttime.txt - Notepad
wait>2
//re-set focus to outlook
setfocus>Inbox - Microsoft Outlook
wait>2
press LCTRL
wait>.2
SendText>n
wait.2
Release LCTRL
wait>5
waitwindowopen>Untitled Message - Microsoft Word
setfocus>Untitled Message - Microsoft Word
wait>1
//send email info TO: [email protected]
sendText>[email protected]

I wanted to use the smtpSendmail but didnt seem to get it working. Not sure if its a port issue as I don't know the ports they are using for email here.

Thanks to everyone who chimed in on this posting.
Just when you thought it was safe to go in the water........:evil:

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