Page 1 of 1

Autohotkey vs. MS Excel 2016

Posted: 27 Feb 2018, 09:15
by Petro
Hi guys,

I use autohotkey to download invoices from our system, however MS Office was recently updated to 2016 version and I guess that is the reason why my script doesn´t work and should be updated.

When I run it, nothing happen, no even the 1 move. Please see below hot it starts:

Start:

; ---- Allows part of the title to be different
settitlematchmode, 2

WinWait, Microsoft Excel -,
IfWinNotActive, Microsoft Excel -, , WinActivate, Microsoft Excel -,
WinWaitActive, Microsoft Excel -,
Sleep, 100
Send, {CTRLDOWN}c{CTRLUP}
Sleep, 200


Could you please advise how to update this script?

Thank a lot.

Petro

Re: Autohotkey vs. MS Excel 2016

Posted: 27 Feb 2018, 10:14
by Delta Pythagorean
First thing I must say, is that this is the Scripts and Functions section. If you have any questions, please post in the Ask For Help subforum.
Second, I suggest using a ComObj to connect to MS Excel. It will connect to all versions of Excel (AFAIK).

Re: Autohotkey vs. MS Excel 2016

Posted: 27 Feb 2018, 10:20
by guest3456
Petro wrote: I use autohotkey to download invoices from our system, however MS Office was recently updated to 2016 version and I guess that is the reason why my script doesn´t work and should be updated.

Start:

; ---- Allows part of the title to be different
settitlematchmode, 2

WinWait, Microsoft Excel -,
IfWinNotActive, Microsoft Excel -, , WinActivate, Microsoft Excel -,
WinWaitActive, Microsoft Excel -,
Sleep, 100
Send, {CTRLDOWN}c{CTRLUP}
Sleep, 200

So your script is looking for the phrase Microsoft Excel - in the titlebar. If Excel2016 has changed the format and wording of its titlebar, that could be a reason why its failing

Re: Autohotkey vs. MS Excel 2016

Posted: 28 Feb 2018, 17:37
by burque505
Here's some Window Spy shots of Excel 2013 and Excel 2016 with a blank workbook. No 'Microsoft' there anywhere.
I don't have Excel 2003 or Excel 2007, so I can't make a comparison.
Excel13.PNG
Excel13.PNG (36.43 KiB) Viewed 718 times
I bet it'll work if you remove 'Microsoft' from the script.
Regards,
burque505

Edit: Yeah, 2003 and 2007 have Microsoft in the title. Here's a shot of Excel 2003:
Excel03.PNG
Excel03.PNG (89.73 KiB) Viewed 716 times

Re: Autohotkey vs. MS Excel 2016

Posted: 28 Feb 2018, 17:43
by jeeswg
Excel 2007:
Window title (what to use in AHK): Microsoft Excel - Book1
Although the custom title bar says: Book1 - Microsoft Excel
Use AHK's WinGetTitle command to find out what you need. You could also check the alt+tab window/the taskbar button/Task Manager for the window title text.