Basically what the title says

Is it possible to "click" on a link created with the <<click>> macro with a key?
If it can't be done, a supplementary question:
How can I call custom macros (I'm thinking mainly <<replace>>) directly in javascript? Is it possible at all?
Thanks a lot in advance
Comments
In any case, try changing #story-caption in that code to #passages.
Beyond that, depending on what you're doing, you're may also need to remove the keyboard handlers. For example, if the key bind shouldn't change (e.g. 'Escape' always opens the same dialog), then you can set it and forget it. On the other hand, if the key bind changes routinely (e.g. 'A' might always mean "go left", generally, but what "go left" means changes from passage to passage), then you'll need to ensure that the previous handlers are removed.
Possible? Yes. Easy and/or desirable. No, generally not.
If you're writing JavaScript, the <<replace>> macro offers you nothing which you don't already have. Simply use the native JavaScript built-ins or jQuery (which SugarCube includes) to perform your replacements.
I'd recommend trying to design it without using click if possible.
I tried wrapping it in a span, yes, but the problem is, sorry to say, I don't know how to target html elements in JQuery like you and greyelf showed in Claretta's topic, neither do I know which ones make up the click link... Otherwise, if I could duplicate <<click>>'s effects without using <<click>> specifically, that would solve it as well.
What I need it for: I'm brainstorming ways to create a WASD 2D movement on a grid, and the
functionality you describe in Sugarcube's documentation seemed to me a good idea. (With keys substituting for actual clicking.)
@Claretta: I have another way to do it, using the timedcycle macro to continually refresh the div that would be influenced by key presses, but I'm not sure if it won't put a strain on the browser, refreshing every half second or so, even when it's not necessary. Does anyone know, actually, if it does? Is it as heavy-handed as I think?
Oh, and thank you all for helping out
Here's how I tried it, with some pseudocode-ish stuff substituted:
And the code (using Mousetrap) to trigger a click on it from the keyboard when "f" is pressed:
FYI: The <<set>> and <<run>> macros evaluate TwineScript, so you don't need to access variables via state.active.variables["…"], you can just access them normally. You only need to use it when you're evaluating pure JavaScript code (e.g. when using the <<script>> macro). For example:
Beyond that, Mousetrap simply calls the given callback when the keyboard event is fired, so your element modifying code should have worked, assuming an element with the ID map actually existed within the page at the time.
As a test I put the following in the StoryInit special passage: n.b. $("#map").html("…") is the jQuery equivalent to document.getElementById("map").innerHTML = "…".
Then I put the following in the Start passage:
And it worked as expected.
(So clean and tidy to look at too.)
And speaking of further work: As far as I can gather from experimentation, Twine macros don't work in innerHTML, correct? Even when I manage to construct something that looks like a macro, using >/< instead of > and <, it just sits there, plain unexecutable text. Is there a way for this to happen, possibly not using innerHTML at all?
Edit: @TheMadExile: No matter! Didi it. Thanks for all the help! Have to say, Sugarcube is a great piece of work and you're doing an amazing work supporting it.