# Which tool to use to create a custom command

**URL:** <https://forum.obsidian.md/t/which-tool-to-use-to-create-a-custom-command/76305>\
**Category:** Help\
**Created:** [February 4, 2024, 4:55pm UTC](https://forum.obsidian.md/t/which-tool-to-use-to-create-a-custom-command/76305 "2024-02-04T16:55:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![holroy](https://forum.obsidian.md/user_avatar/forum.obsidian.md/holroy/32/77699_2.png) [@holroy](https://forum.obsidian.md/u/holroy)\
**Post date:** [February 4, 2024, 4:55pm UTC](https://forum.obsidian.md/t/which-tool-to-use-to-create-a-custom-command/76305/1 "2024-02-04T16:55:21Z")

</div>

After coding [this answer](https://forum.obsidian.md/t/use-aliases-with-templater-suggester/76244/3), where I use _Templater_ to build a suggester of files with file aliases, ala _Quick Switcher_, I want to build a command which either chooses an existing file or creates a new file. But the question I would like some input on is: **Where (and with which plugin) would you use to create a custom command?**

So far I’ve used either _Templater_ based commands, or variants of _QuickAdd_ script, but this time I’m aiming for a command which should do three things:

- Have a suggester to choose a potential existing file name (or store the new file name suggestion)
- If existing, triggering an open file command (from some API)
- If not existing, trigger a _Templater_ `tp.file.create_new()`

So what tool would you use to create such a command? I would like for it to be assigned a hotkey, and to be able to trigger it without necessarily having an open file (which kind of rules out _Templater_ ).

Note that I’m not asking about coding the command, just how and where to put the code which eventually creates the command within a suitable environment for me to continue from. (Although a suggestion on which command to use to open a file is appreciated 🙂 )

As stated _Templater_ is most likely ruled out since I then need to have an active editor, and I don’t really like the convoluted way of defining commands through _QuickAdd_ (with a choice, having a macro, linked to a function file, and then configured to trigger that function… ).

---

<div class="post-metadata">

**Author:** ![holroy](https://forum.obsidian.md/user_avatar/forum.obsidian.md/holroy/32/77699_2.png) [@holroy](https://forum.obsidian.md/u/holroy)\
**Post date:** [February 27, 2024, 1:04pm UTC](https://forum.obsidian.md/t/which-tool-to-use-to-create-a-custom-command/76305/2 "2024-02-27T13:04:04Z")

</div>

This has gained a lot less traction than I hoped to, so let me try to increase the traffic by describing some of the mixture of tools I’m currently using:

- `dv.view()`-scripts for some more _Dataview_ related stuff
- _Templater_ user functions for the more specific _Templater_ stuff
- Some odd-ball _CustomJS_ functions, but haven’t made an transition into using that
- Some _QuickAdd_ javascript functions, but for my needs it feels a little convoluted as it requires a lot of steps to trigger any of my custom commands
- I’ve even tried a slightly older _User Plugins_ which allows to do custom commands either in javascript files, or through snippets in its settings section. Kind of like the concept of this one

I’ve also contemplated on using the _Startup_ template of _Templater_ to create commands, or “misusing” _dataviewjs_ or similar. But I’m a little worried on how to handle command updates/modification and so on.

I’ve not used _RunJS_, _JavaScript Init_, _JS Engine_ or _Run_, although I’ve heard of them. I’ve neither tried the likes of _Code Emitter_ or _Inline Scripts_ or _Modules_ (or _Micro templates_).

I’m trying out _VSCode editor_, which should get an update to eliminate a rather noisy console issue (which can be hidden/ignored though), and this plugin allows me to do rather nice javascript and CSS editing within Obsidian. I’m not eager to use _Code Files_ due to its online dependency, and the implications of that dependency.

---

<div class="post-metadata">

**Author:** ![gino\_m](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/g/3ec8ea/32.png) [@gino\_m](https://forum.obsidian.md/u/gino_m)\
**Post date:** [February 27, 2024, 2:53pm UTC](https://forum.obsidian.md/t/which-tool-to-use-to-create-a-custom-command/76305/3 "2024-02-27T14:53:59Z")

</div>

So far my usage is 95 percent Templater Js and 5 percent QuickAdd (for stuff I saw on the internet).

Inline Scripts I tried (to look into), but the RPG theme and the default srcipts were too out of line with my use cases.

I’d like to use the DVJs oneliners with `dv.view` but they they throw the promise error (or on await I get `-` as “result”).

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [May 27, 2024, 2:54pm UTC](https://forum.obsidian.md/t/which-tool-to-use-to-create-a-custom-command/76305/4 "2024-05-27T14:54:28Z")

</div>

Closed on May 27, 2024, 2:54pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
