hey guys, after researching for some time I have only found this addon on name " Customize Keyboard Shortcuts" but it does not seem to work for me.
Actually I have to do bunch of type in cards, most of the time I Do writting on paper but sometime when I’m exhausted I recourse to avail type in field benefit, and I want to to connect my game controller to anki for more productivity, I used key2joy to assign hotkeys to controller keys, I was hoping success but it did not work out because in anki desktop type in field is auto focused and there is not way to turn it off like in ankidroid, and single alphabat hotkeys like “R” just typed in in field rather than working as hotkey for there assign task.
If you want the typing field to be automatically defocused when the card opens, you can try adding the following code to the end of the front template:
Yes, right to the bottom of the Front Template code.
In case it won’t work right away and the typing field is still focused when a card is displayed, try replacing the 0 at the end of this code to something like 10 or 100.
It sets a delay in milliseconds before the defocusing occurs so that it won’t accidentally happen before Anki focuses the typing field overwriting the change. For me it seems to work just fine with 0, but there might be differences on other devices due to variance in processing speed.
thank you so much for your assistance, it worked out great for me.
just one more thing, is it possible to assign key on controller to work on specific slide like just Front side or Back side or both same as in ankidroid, so that i can use same key on controller for different task on different slide of card.
how can i avoid this annoying pop up ? my tts tag works fine on android and i want to keep it but it does not work on pc and shows this annoying pop up, is it possible to not use specific code on desktop but will work on ankidroid ?
That depends on the tasks you want to assign. If that’s something that only needs to happen within a card, like showing a hint, or replaying the audio, it is easy to do by adding an empty element to the back of the card and assigning an action to a key listener based on whether this element is present or not. If it is a review action like flipping a card or rating an answer, it can be done in the same way by invoking the respective pycmd call. If it is something that has to do with editing the database, like changing the content of a certain field, then I don’t think it is possible without writing an add-on for this purpose (or finding an existing one that provides the needed functionality).
I’m afraid not. The code on the card only allows certain parts to be hidden after the fact, so it won’t prevent something like TTS from trying to be executed. But judging by the message, your problem is not specific to Anki, but rather to how TTS is configured on your system in general. Maybe it’s better to try and resolve that problem instead of hiding it? You should probably create another topic for that, as it is a completely separate issue. I never had any problems with TTS on my machine, and don’t think I can be of much help regarding it in general. But if anything else fails, you can try installing one of the add-ons that overwrite default system TTS service with their own, such as this one.
You put something like this anywhere on the back of the card template:
<hr id='backside' style="display: none">
and then use this piece of code inside a script that does something based on the side of a card it is running on:
if (!document.getElementById('backside')) {
// put here something to be done on the front
} else {
// put here something to be done on the back
}
(if you are using the basic card template, there is already the element <hr id=answer> on the back that can be used for differentiating the sides. So if this is your case, you can use the same “if” statement inside your code simply changing the ‘backside’ id to ‘answer’ and without inserting anything else)