"Send" function no longers inserts into Firefox

Get help with using AutoHotkey and its commands and hotkeys
Posts: 20
Joined: 10 Dec 2016, 14:09

"Send" function no longers inserts into Firefox

22 Jan 2018, 16:22

I have a number of autohotkey shortcuts such as:

#!a:: Send MyString

These have worked reliably for a long time. Suddenly, they have no effect in Firefox?
If I place the cursor in a firefox field, and press the shortcut combination, nothing happens.

If I open Notepad and press the same shortcut combination, my string gets inserted.

Then I can copy and paste it into Firefox, but why has firefox stopped accepting AutoHotkey "Send" input?

Is there another way to code these that works better?
Posts: 3
Joined: 14 Nov 2016, 10:29

Re: "Send" function no longers inserts into Firefox

22 Jan 2018, 16:27

You could try #!a::SendInput MyString but I doubt that will make the difference. Instead maybe giving your AHK admin rights will allow it to work on firefox. Try to right click your file and run as admin, does it work now?
Posts: 20
Joined: 10 Dec 2016, 14:09

Re: "Send" function no longers inserts into Firefox

22 Jan 2018, 22:17

I have a startup shortcut to start AutoHotkey at boot. It has never needed any elevation before.
Just to see if it made any difference, I quit AutoHotKey, and was going to re-start it with elevation from the start menu.
However, now when I start it (with or without elevation), I get this error:

Error at line 67
Line text: A_CoordModeMouse
Error: Not allowed as an output variable
the program will exit.

This script has run without problems for years. Why would it suddenly fail with an error now? Maybe my AutoHotKey is corrupt?
User avatar
Posts: 800
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: "Send" function no longers inserts into Firefox

22 Jan 2018, 22:41

timg11 wrote:... Why would it suddenly fail with an error now? Maybe my AutoHotKey is corrupt?
It isn't easy, supporting without whole information and even without crystal ball. :mrgreen:
When you would paste a bit more or whole script, it should be much easier to find the bug.
Posts: 20
Joined: 10 Dec 2016, 14:09

Re: "Send" function no longers inserts into Firefox

24 Jan 2018, 09:48


Here is the code that I have been running for several years without issue. This is a snippet out of a larger WinWait block that automatically handles various "pop up" windows.

The general structure of the entire routine is this:

SetTitleMatchMode, RegEx
WinWait, (--regular-expression-matching-a-group-of-possible-windows-that need to be processed}
SetTitleMatchMode, 2
sleep 500
IfWinExist, Window-Name-1
..... handle Window-Name-1

IfWinExist, Window-Name-2
..... handle Window-Name-2

.... and so on for all windows that might pop up

The section with the problem is as follows:

Code: Select all

        IfWinExist, MobilePASS
        if DoneIt = 0       ; only execute this block of code once, when the window appears
              WinActivate, MobilePASS
              WinGetPos, Xpos, Ypos
	      WinMove Xpos-500,Ypos
              CoordModeSaveVal = A_CoordModeMouse
              CoordMode, Mouse, Window
              Click 150,105
             A_CoordModeMouse = CoordModeSaveVal
             DoneIt = 1
	      Sleep 500
The lines"
CoordModeSaveVal = A_CoordModeMouse
A_CoordModeMouse = CoordModeSaveVal"
were intended to save and restore the Coordinate mode since this procedure changes it temporarily.

The second line has been a valid syntax for all this time. Now it has somehow become an error, and this change occurs without updating AutoHotKey?
I can get the script to run again by commenting out the second line, but why is it now not valid?
Posts: 6021
Joined: 30 Sep 2013, 06:48

Re: "Send" function no longers inserts into Firefox

24 Jan 2018, 10:50

Regarding Firefox, it could probably be that a new Firefox version needs admin rights to accept sent keys (or perhaps, it is caused by changed/updated security settings/software on your computer).

But, on the other hand, I don't think that

Code: Select all

A_CoordModeMouse = CoordModeSaveVal
was ever allowed, since the AHK variable A_CoordModeMouse was introduced in [v1.1.23+] (before it was probably allowed, but would have been without real effect in the code snippet you have shown, without CoordMode using it). Perhaps there were versions where this error was just ignored, that might be possible.

But you cannot overwrite or set a built-in AHK variable like this; in this case you would need CoordMode to change the setting and the contents of this variable. Compare https://autohotkey.com/docs/Concepts.ht ... -variables:
A number of useful variables are built into the program and can be referenced by any script. With the exception of Clipboard, ErrorLevel, and command line parameters, these variables are read-only; that is, their contents cannot be directly altered by the script.
That's why this line throws an error.

Btw, this line

Code: Select all

CoordModeSaveVal = A_CoordModeMouse
writes the string "A_CoordModeMouse" into the variableCoordModeSaveVal, and not its contents (for example, "Window"). Check with a msgbox! To put the contents of A_Coord... into another variable you would have to use

Code: Select all

CoordModeSaveVal := A_CoordModeMouse
; or
CoordModeSaveVal = %A_CoordModeMouse%
; or
CoordModeSaveVal = % A_CoordModeMouse
and that never changed in any AHK version.
The same would go for A_CoordModeMouse = CoordModeSaveVal, if it would be allowed.
You say that you didn't update AHK... so which version are you running? But... either you updated from something lower than v1.1.23 (and the script didn't work as intended before, but showed no error because the variable wasn't built-in) or, that is most probably not the script you were running before.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], lucfig, NewtSoup, TAC109, theon and 41 guests