fix-outlook-line-breaks.ahk - how to get it working?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ahwul62
Posts: 9
Joined: 12 Nov 2017, 08:11

fix-outlook-line-breaks.ahk - how to get it working?

20 Jan 2018, 08:29

Up front, I have no knowledge about scripting and how exactly to use autohotkey.

In the past I have been using 1 single script to solve an issue.
That was working fine for a long time and actually I didn't look at it.
However, after after some updates and a clean Windows install and even though I -think- I have installed autohotkey and the .ahk file as before
(I made screenshots of the steps at the time) the script doesn't work.

I am seeking a helping hand as to how I should proceed to get it working.

1. Windows 10 x64 latest version (1709)
2. I installed the x64 version of the latest Autohotkey
3. the fix-outlook-line-breaks.ahk is in the Autohotkey folder
4. Copy-Pasted fix-outlook-line-breaks.ahk as a shortcut in
C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Contents of the autohotkey folder: see screentshot

-
SnagIt-20012018 142014.png
SnagIt-20012018 142014.png (37.28 KiB) Viewed 2671 times
-


Contents of the .ahk file, see below.

Issue:
a) Autohotkey.exe seems not to be loaded (the button does not show up in the taskbar)
b) So the .ahk file is not loaded
c) with I rightclick run as admin the ahk file, the Autohotkey button shows up in the taskbar

But there is no change in behavior when hitting the 'Enter'-key.
When I send something to gmail and back I get it back with double line spacing (in case of using 'Enter' only)
Shift enter works fine though.

What am I doing wrong?
Should I install the 32bit version? (during setup the x64 part was already 'pre-selected', so I used that)

Thanks!


=
fix-outlook-line-breaks.ahk
#NoEnv
#SingleInstance force
SetTitleMatchMode 2
SendMode, Input
Return
^esc::exitapp
#IfWinActive, - Bericht
$+Enter::Send, {Enter}
$Enter::Send, +{Enter}
$+NumpadEnter::Send, {Enter}
$NumpadEnter::Send, +{Enter}
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: fix-outlook-line-breaks.ahk - how to get it working?

20 Jan 2018, 09:21

ahwul62 wrote:a) Autohotkey.exe seems not to be loaded (the button does not show up in the taskbar)
Does it show up in the overflow area (after you click the triangle left of all the icons)?
c) with I rightclick run as admin the ahk file, the Autohotkey button shows up in the taskbar
But there is no change in behavior when hitting the 'Enter'-key.
When I send something to gmail and back I get it back with double line spacing (in case of using 'Enter' only)
Shift enter works fine though.
Your script only works for windows containing the phrase "- Berichten" in the title caption. Are you still using the Dutch (?) version of Outlook, or perhaps a newer version that doesn't have that phrase in it anymore?
Should I install the 32bit version? (during setup the x64 part was already 'pre-selected', so I used that)
Doesn't matter in this case.
ahwul62
Posts: 9
Joined: 12 Nov 2017, 08:11

Re: fix-outlook-line-breaks.ahk - how to get it working?

21 Jan 2018, 02:28

Thanks for the reply!
No, it does not show up there. In Windows - > Taskbar Settings -> Notification Area -> Select which icons ...
I have 'Always show all icons in the notification area' : ON (Autohotkey isn't listed there).

By default I use the Dutch version of Outlook 2016, but may change to the English version if needed (e.g. when I wish to update Office settings, in line with English step-by-step guide).

Note that by double clicking the ahk file, autohotkey will show up in the taskbar, but it does not work.
I changed 'Bericht' to 'Berichten' - that did not help either

FWIW the window title reads
-
SnagIt-21012018 082408.png
SnagIt-21012018 082408.png (1.5 KiB) Viewed 2635 times
-
ahwul62
Posts: 9
Joined: 12 Nov 2017, 08:11

Re: fix-outlook-line-breaks.ahk - how to get it working?

21 Jan 2018, 02:37

Later... I -removed- the line: #IfWinActive, - Bericht
so the script now reads:

fix-outlook-line-breaks.ahk
#NoEnv
#SingleInstance force
SetTitleMatchMode 2
SendMode, Input
Return
^esc::exitapp
$+Enter::Send, {Enter}
$Enter::Send, +{Enter}
$+NumpadEnter::Send, {Enter}
$NumpadEnter::Send, +{Enter}

now indeed one I hit the [Enter] key a paragraph break shows up

-
SnagIt-21012018 083617.png
SnagIt-21012018 083617.png (3.37 KiB) Viewed 2634 times
-

Now, one thing is still left: how to have autohotkey run at startup?
I pasted the .ahk as shortcut in the startup folder (see my earlier post)
ahwul62
Posts: 9
Joined: 12 Nov 2017, 08:11

Re: fix-outlook-line-breaks.ahk - how to get it working?

21 Jan 2018, 03:47

Later:
Autohotkey.exe, properties, tab: Compatibility : tagged 'Run this program as an administrator"
did the same for AutohotkeyU64.exe (don't know if that matters, probably not)
did the same for fix-outlook-line-breaks shortcut in \startup folder, r-click, advanced, tagged 'Run as administrator'.
Rebooted of course

Autohotkey v1.1.27.04 x64
Windows 10 x64 (1709, build 16299.192)

AFAIK there are no AV-issues (nothing in quarantine or so, after all I can launch the .ahk or shortcut manually)
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: fix-outlook-line-breaks.ahk - how to get it working?

21 Jan 2018, 07:57

4. Copy-Pasted fix-outlook-line-breaks.ahk as a shortcut in
C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Since this should be the correct path to autorun applications, I wondering whether 'Username' refers to your actual username? Are there any other folders in the folder C:\Users\? Perhaps your user number if it's a corporate computer?
Later... I -removed- the line: #IfWinActive, - Bericht
Good that it works now, but it's active for every application now, which may cause undesired effects. Run WindowSpy.ahk and activate a new Outlook e-mail message window, now copy and paste to contents of the top text field of the Window Spy dialog here (with the ahk_class and ahk_exe), so we can correct that line.
ahwul62
Posts: 9
Joined: 12 Nov 2017, 08:11

Re: fix-outlook-line-breaks.ahk - how to get it working?

21 Jan 2018, 08:22

I merely replaced my name with 'username' for privacy reasons. Nothing special.
It also works in Word, which is okay. I believe it won't work other editors (like text editors, or the text boxes in forums)

As for WindowSpy.ahk
before starting/using it, what is it supposed to do?

Could there be any issues with Windows 1709 ?

-
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: fix-outlook-line-breaks.ahk - how to get it working?

21 Jan 2018, 09:30

I figured 'Username' is not your actual name, but it's strange the shortcut doesn't run on startup. That's why I was thinking you may have been using the wrong user's startup folder (for my corporate laptop, the 'username' folder does not match my login username).

Window spy just shows some information about the active window you can use to fix the #IfWinactive line. But if it works ok, no need to change it.
Screenshot of old version:
Image
ahwul62
Posts: 9
Joined: 12 Nov 2017, 08:11

Re: fix-outlook-line-breaks.ahk - how to get it working?

21 Jan 2018, 10:26

FWIW - I uninstalled autohotkey and re-installed it with admin rights - deleted the shotcut in startup and created a new one
rebooted.
Nothing... :-(

when I rightclick on the .ahk file - I see a 'Compile Script' option. I don't know what it is and it gets pretty vague for me.
So I tried it - whatever ..
I got a .exe file.
Maybe I should put that in the startup folder then?

-
SnagIt-21012018 162315.png
SnagIt-21012018 162315.png (21.94 KiB) Viewed 2590 times
-

If not, well, I forget about it then. It doesn't work, at least it doesn't load automatically. Too much time spent on this small issue.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: fix-outlook-line-breaks.ahk - how to get it working?

21 Jan 2018, 15:21

I wouldn't see how that's going to make a difference. Your script works when you start is manually but doesn't auto-start. So I'd first start looking whether it is started in the first place. Are there any other shortcuts in the startup folder that are executed? If not, place a shortcut to notepad or something in there, and see if it is started when you reboot.
ahwul62
Posts: 9
Joined: 12 Nov 2017, 08:11

Re: fix-outlook-line-breaks.ahk - how to get it working?

29 Aug 2018, 03:33

Getting back on this again.
I have not been using this script for quite a while.

Wanted to start using it. But I can't get it 'auto started'

a) Installed Autohotkey v1.1.30.00 x64 on my x64 Windows 10 pc (build 1803)
b) Installed it in D:\Autohotkey
c) verified that both Autohotkey.exe and AutoHotkeyU64.exe Properties->Compatability "Run this program as an administrator" are tagged
d) copied fix-outlook-line-breaks.ahk and pasted into the Windows startup folder as shortcut
e) verified that this shortcut is 'Run as administrator' as well

rebooted
the autohotkey button did and does not show up in the taskbar
(with me, by default, all buttons show up, i.e. if it is loaded, it should show)


only.. when I rightclick the .ahk file and run it as administrator, the button will show up.

After a couple of reboots and attempts to get it working, I checked out Task Manager->Startup
fix-outlook-line-breaks.ahk shows up there, but 'disabled'.

The C:\Users\MyName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup folder contains only ' the fix-outlook-line-break - shortcut'.
Nothing else there.

When I rightclick the fix-outlook-line-breaks.ahk file (not the shortcut) located in D:\Autohotkey I can run it as administrator and it will show up in the taskbar.

Then indeed in Taskmanager - Startup - disabled changes into enabled.
However, after reboot it changes back to disabled again.

Autohotkey is marked as 'Trusted' within my AV software.

Contents of the .ahk file is still the same as in my post of 12 Nov 2017.

Any suggestions please?

Thanks!

p.s.: when fix-outlook-line-breaks.ahk is manually run, as admin, then it works fine...
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: fix-outlook-line-breaks.ahk - how to get it working?

29 Aug 2018, 05:40

Nextron wrote:Are there any other shortcuts in the startup folder that are executed? If not, place a shortcut to notepad or something in there, and see if it is started when you reboot.
?
ahwul62
Posts: 9
Joined: 12 Nov 2017, 08:11

Re: fix-outlook-line-breaks.ahk - how to get it working?

30 Aug 2018, 02:38

Eh... maybe I am misunderstanding you(?) and you are meaning something different.
However, as said above, it is the only shortcut in the startup folder.
lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: fix-outlook-line-breaks.ahk - how to get it working?

30 Aug 2018, 03:13

ahwul62 wrote:c) verified that both Autohotkey.exe and AutoHotkeyU64.exe Properties->Compatability "Run this program as an administrator" are tagged
d) copied fix-outlook-line-breaks.ahk and pasted into the Windows startup folder as shortcut
You must either remove the "run as administrator" compatibility settings or use a different method of auto-start, such as task scheduler. I would recommend removing the compatibility settings either way, as running all scripts as admin by default can be dangerous.

Windows blocks programs from auto-starting via certain methods if they require elevation. Vista used to show a notification that it was blocked (on startup), but I'm not sure about later versions.

If you are running the script as admin because you are automating Outlook and Outlook is running as admin, I would recommend not running either as admin. In general, I would highly recommend not running any email client as admin.

If you are somehow required to run Outlook as admin, you can use task scheduler to start the script, or make the script work without admin by using 'Run with UI Access' as mentioned in the FAQ. Once the option is enabled, you can use one of the additional AutoHotkey*UIA.exe files that it creates instead of AutoHotkey.exe.
ahwul62
Posts: 9
Joined: 12 Nov 2017, 08:11

Re: fix-outlook-line-breaks.ahk - how to get it working?

31 Aug 2018, 00:55

Many thanks indeed!

That was and is the solution.
First I removed the run as administrator tags from the .ahk file, rebooted. In the task manager, startup tab, the .ahk file was 'enabled' (whereas it was showing disabled before), but it wasn't working. Also the autohotkey button in the taskbar did not show up.

After removing the run as administrator tag from both the autohotkey.exe and autohotkeyu64.exe and rebooting, indeed the autohotkey button showed up in the taskbar and above all: the fix-outlook-line-breaks worked!

Again, many thanks.
Truly appreciated - wouldn't have figured this out myself.

=
SnagIt-31082018 075212.png
(4.29 KiB) Downloaded 118 times
=

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], marypoppins_1, ShatterCoder and 150 guests