You will have to use The Key History in AutoHotKey to find out the ScanCode or keyname of your G4 key to launch this. Alternatively, you could map the G4 key internally to e.g. CtrlAltWinF12 and use the 2nd hotkey option.
The script will only execute when Firefox is active. It will Launch the rightClick menu, then send v, wait for the save as window and click Enter.
#SingleInstance Force #installKeybdHook #Persistent #IfWinActive, ahk_class MozillaWindowClass SC123:: ; or ^!#F12::, select one of the two options Send, Sleep, 30 Send, v WinWaitActive, Save Image ControlSend, Button1,, Save Image Return #IfWinActive
Find the scancode:
Right Click on AutoHotKey Icon. Select Open
, Type Ctrlk, hit G4, then F5 to refresh the page and see the scancode for G4 towards the bottom.
In AutoHotKey you can define hotkeys in multiple ways. Examples:
a::Send, Hello World!
When you press a it will send "Hello World" to whatever is active on your screen right then.
F12::Send, Hello World!
Same but now for the F12 key
^!#F12::Send, Hello World!
Same but now for the Ctrl+Alt+Win+F12 key combination
F1::Send,
Would remap your F1 key into the behaviour of the F12 key
SC058::Send, Test
Uses ScanCode 058 (is the F12 key) to send "Test".
:*:ahk::AutoHotKey
Expands abc into the word AutoHotKey.
In your situation, you will have to decide which hotkey combination will trigger the script.
Here is some documentation:
http://www.autohotkey.com/docs/KeyList.htm
http://www.autohotkey.com/docs/Hotkeys.htm
Oh, übrigens, the double ::
separates the hotkey from the action and the ;
is the comment separator. Grüsse.