Remapping Function keys exclusively ?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
aneng
Posts: 4
Joined: 02 Aug 2016, 14:13

Remapping Function keys exclusively ?

31 Jan 2017, 19:15

Hi,

I'm trying to simply get F1 to do Ctrl-C and F2 to do Ctrl-V, nothing more ! However, I need it to do this to copy data out of a web page displayed in Chrome. I've created an AHK file to remap the keys but Chrome insists on opening Developer Tools when I press F1 (which is odd in itself - I thought F1 was 'Help' and F12 was 'Developer Tools').

I know AHK is grabbing the keypress before Chrome sees it as I can completely disable F1 with 'F1::return'. What I can't seem to do is to get AHK to perform Ctrl-C when I press F1 and not forward the F1 keypress onto Chrome as well.

Any suggestions ?

Many thanks !
User avatar
boiler
Posts: 17194
Joined: 21 Dec 2014, 02:44

Re: Remapping Function keys exclusively ?

31 Jan 2017, 19:55

Not having that problem here. You have F1::^c in your script?
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
Contact:

Re: Remapping Function keys exclusively ?

01 Feb 2017, 00:46

Like he said, or you might want to try by keycode ^{sc02E}

Code: Select all

F1::^c
F2::^v
F3::selectAllAndCopy()

Esc::ExitApp
Return
ExitApp
 
selectAllAndCopy() {
	send ^{a}
	send ^{sc02E}  ; same as ^c
}
aneng
Posts: 4
Joined: 02 Aug 2016, 14:13

Re: Remapping Function keys exclusively ?

01 Feb 2017, 03:50

boiler wrote:Not having that problem here. You have F1::^c in your script?
No actually ! I had

Code: Select all

F1::
Send ^C
return
Your version worked perfectly, thanks. What did I do wrong ?
User avatar
boiler
Posts: 17194
Joined: 21 Dec 2014, 02:44

Re: Remapping Function keys exclusively ?

01 Feb 2017, 06:11

You didn't actually remap the F1 key, you created a hotkey that runs a subroutine when F1 is pressed. Remapping causes the F1 key to become the ^c key combination. See the documentation for the differences between hotkeys and remapping.
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
Contact:

Re: Remapping Function keys exclusively ?

01 Feb 2017, 06:17

Its

Code: Select all

Send ^{c}
That's what you did wrong
aneng
Posts: 4
Joined: 02 Aug 2016, 14:13

Re: Remapping Function keys exclusively ?

01 Feb 2017, 08:57

Thanks very much for your help. Much appreciated.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 105 guests