'AutoHotKey script for Adobe Acrobat and SketchUp export hotkeys

I am trying to make Windows+Shift+E (+SHIFT+E) hotkey in order to quicken exports in SketchUp and Adobe Acrobat. The AutoHotKey sript is as follows:

SetTitleMatchMode, 2
#+e::

If WinActive("Acrobat")
    SendInput, {Alt down}
    SendInput, f
    SendInput, t
    SendInput, t

If WinActive("SketchUp")
WinMenuSelectItem, , , File, Export, 2D Graphic...
    SendInput, test.png

Return

The SketchUp export hotkey works fine, but I am running into issues with Adobe Acrobat. The WinMenuSelectItem, , , File , Export To, Microsoft PowerPoint Presentation (and WinMenuSelectItem in general) does not work on Adobe products. Therefore I have resorted to using SendInput for Adobe Acrobat.

If I run the script when SketchUp window is active, it does everything it is supposed to do, but for some reason there are some artifacts from the If WinActive("Acrobat") conditional statement part. The "test.png" parts ends up being "tttest.png", "ftttest.png" and etc.

If I run the script when Adobe Acrobat window is active, then it is only able to run once and the Windows () key stops working (and some other mayhem), and I have to logout of Windows and log in back in order to resole that.

Could anyone advise me on what is the issue with the If WinActive("Acrobat") conditional statemen part of the script?



Solution 1:[1]

I have missed something very simple – {Alt down} requires {Alt up} afterwards. Otherwise the Alt stays pressed, which explains all the mayhem. Therefore I have replaced the SendInput, {Alt down} line with SendInput, {Alt} and all is fine with the world.

SetTitleMatchMode, 2
#+e::

If WinActive("Acrobat")
    SendInput, {Alt}
    SendInput, f
    SendInput, t
    SendInput, t

Return

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marius Lazauskas