Page 1 of 1

API for simulating hotkey

Posted: 10.07.2024 00:39
by SamC
Hello,
I want to make a command to process some text,and after that calling another command by hotkey.
I suppose there are api to simulate hotkey but didn't find it. Please provide some guidance.
Thanks!

Re: API for simulating hotkey

Posted: 10.07.2024 07:07
by main Alexey
API cannot emulate a hotkey.

Editor.cmd() method is to call any command by int code.
https://wiki.freepascal.org/CudaText_API#Editor.cmd

also, if you need to find that int code, you can enumerate all commands list. via
app_proc(PROC_GET_COMMANDS, '')

wiki tells about it at:
https://wiki.freepascal.org/CudaText_AP ... ugin_calls

Re: API for simulating hotkey

Posted: 10.07.2024 09:18
by SamC
Thanks! Will that plugin code change between different computers?

Re: API for simulating hotkey

Posted: 10.07.2024 15:41
by main Alexey
If int command code is code of PLUGIN then yes, it will change. so first you should find the int code in the list returned by
app_proc(PROC_GET_COMMANDS, '')

Or, if you know what plugin module name + method name you call, e.g. cuda_my / my_func, then call another API:
app_proc(PROC_EXEC_PLUGIN, 'cuda_my,my_func')

https://wiki.freepascal.org/CudaText_AP ... c_-_Python

Re: API for simulating hotkey

Posted: 11.07.2024 05:43
by SamC
Get it,Thanks!

Re: API for simulating hotkey

Posted: 11.07.2024 10:52
by main Alexey
you mean "Got it".