What are you really trying to do? I ask because maybe you don't need
AutoKey for it.
This is something I've read about, but not done.
(In what follows, substitute the name of your favorite scripting (or
even compiled) language for "bash".)
I found:
http://www.techrepublic.com/article/find-and-bind-key-sequences-in-bash/
which (among other things) tells you how to get the character
sequence for a function key.
Maybe you could write a simple bash script that emits this character
sequence at timed intervals. If you just want to affect what's
running in a terminal, maybe this would take care of it.
If the F5 needs to go into a gui app, then that's a bit trickier.
The tool for that is
xdotool.
You can tell xdotool to send most anything a keyboard (or mouse) can
send and you can tell it what window to send it to.
http://linux-commands-examples.com/xdotool
This even has an example that finds the window and sends F5 to it. A
pretty good start for you!
This can still all be done in bash. If it needs to be launched from
a hotkey, then an AutoKey macro can use Python to launch your script
in the background (so you can stop or kill it without killing
AutoKey).
If you save the script's process ID to a file, you can use another
script to kill it or kill it by name using pkill. Or you can just
have the script look at a (semaphore) file (created when the script
first gets invoked - either by the script or by the macro). If the
file is there, keep running. If it's not, then exit. Then, you just
need another script and/or macro to delete the file when you want
the first script to quit.
Joe