API for simulating hotkey

Post Reply
SamC
Posts: 211
Joined: 12.08.2023 00:49

API for simulating hotkey

Post 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!
main Alexey
Posts: 2404
Joined: 25.08.2021 18:15

Re: API for simulating hotkey

Post 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
SamC
Posts: 211
Joined: 12.08.2023 00:49

Re: API for simulating hotkey

Post by SamC »

Thanks! Will that plugin code change between different computers?
main Alexey
Posts: 2404
Joined: 25.08.2021 18:15

Re: API for simulating hotkey

Post 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
SamC
Posts: 211
Joined: 12.08.2023 00:49

Re: API for simulating hotkey

Post by SamC »

Get it,Thanks!
main Alexey
Posts: 2404
Joined: 25.08.2021 18:15

Re: API for simulating hotkey

Post by main Alexey »

you mean "Got it".
Post Reply