Expansion does not work in Chrome/FF, fine in text editor/Word

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Coffeecup
Posts: 4
Joined: 25 Oct 2021, 18:32

Expansion does not work in Chrome/FF, fine in text editor/Word

Post by Coffeecup » 25 Oct 2021, 18:37

In the past six months, text expansion in Chrome/FF is spotty.
Sometimes works briefly after restarting script, but then is just ignored.
I can check which script AHK ran last, and it appears to be working, but the expanded text does not appear in browser.
I switch to Word or Notepad++, works great.
Any ideas?

User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: Expansion does not work in Chrome/FF, fine in text editor/Word

Post by mikeyww » 25 Oct 2021, 20:19

Welcome to AHK. You can post your script here to get feedback about it.

Coffeecup
Posts: 4
Joined: 25 Oct 2021, 18:32

Re: Expansion does not work in Chrome/FF, fine in text editor/Word

Post by Coffeecup » 26 Oct 2021, 07:54

Thank you!

Sample from script:

Code: Select all

;patent
::(ca::(Currently Amended)
::(wd::(Withdrawn)
::(can::(Canceled)
::(pp::(Previously Presented)
::(ori::(Original)
::(ne::(New)

;symbols

;:*: ppara::{ASC 0182}
;:*: ss::{ASC 0167}
;:*: endash::{ASC 8211}
;:*: emdash::{ASC 8212}

:*:ppara::{ASC 0182}
:*:ss::{ASC 0167}
:*:endash::{ASC 8211}
:*:emdash::{ASC 8212}
:*:theta::{ASC 233}
;:*:phi::{ASC 232}


;date

:*:fdate::
FormatTime, CurrentDateTime,, yyyy-MM-dd
SendInput %CurrentDateTime%
return

:*:tdate::
FormatTime, CurrentDateTime,, yyyy-MM-dd HHmmss
SendInput %CurrentDateTime%
return

:*:ldate::
FormatTime, CurrentD

;long

^#v::                            ; Text–only paste from ClipBoard - Ctrl-Win-V
   Clip0 = %ClipBoardAll%
   ClipBoard = %ClipBoard%       ; Convert to text
   Send ^v                       ; For best compatibility: SendPlay
   Sleep 50                      ; Don't change clipboard while it is pasted! (Sleep > 0)
   ClipBoard = %Clip0%           ; Restore original ClipBoard
   VarSetCapacity(Clip0, 0)      ; Free memory
Return
[Mod edit: [code][/code] tags added.]

User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: Expansion does not work in Chrome/FF, fine in text editor/Word

Post by mikeyww » 26 Oct 2021, 08:28

Since your script does not work, test a shorter piece of it.

Code: Select all

::(ca::(Currently Amended)
::(wd::(Withdrawn)
::(can::(Canceled)
::(pp::(Previously Presented)
::(ori::(Original)
::(ne::(New)
This worked for me. If it works at your end, you can expand slowly, adding one small piece at a time, and testing carefully along the way. If your Web browser is using another keyboard shortcut manager, it might conflict.

Subroutines should generally end in Return if they have multiple lines.

If you set the clipboard, use ClipWait. Example

Coffeecup
Posts: 4
Joined: 25 Oct 2021, 18:32

Re: Expansion does not work in Chrome/FF, fine in text editor/Word

Post by Coffeecup » 28 Oct 2021, 09:14

Thank you mikeyww.
I have tried a smaller script, and the problem exists: works fine outside browser, no response inside browser.
Is there an alternative means of sending the keystrokes for text expansion?

User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: Expansion does not work in Chrome/FF, fine in text editor/Word

Post by mikeyww » 28 Oct 2021, 09:27

Do you mean that the script that I posted does not work in your browser?

Try this one alone.

Code: Select all

:COT:(ca::(Currently Amended)

Coffeecup
Posts: 4
Joined: 25 Oct 2021, 18:32

Re: Expansion does not work in Chrome/FF, fine in text editor/Word

Post by Coffeecup » 28 Oct 2021, 09:51

The most-recent snippet only works once.

I run script, try in Gmail, works.
Click to File Explorer, back to Gmail, expansion does not work. But still works find in Notepad++, etc, just not in browsers.

Code: Select all

:COT:(ca::(Currently Amended)

User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: Expansion does not work in Chrome/FF, fine in text editor/Word

Post by mikeyww » 28 Oct 2021, 11:35

You are typing the hotstring into a newly composed Gmail message in Chrome? Exactly what are you typing there?

Your script has no other code, and no other scripts are running?

Post Reply

Return to “Ask for Help (v1)”