Debug real javascript

I have successfully debugged javascript code in a floating web view. However, I haven't found a way to debug real javascript when run as an action (that is not a floating web view). Is this possible? Thanks

you can’t really attach a debugger to it. You can use the BTTLog("some string") function, which when called posts a notification to the macos notification center.

This at least helps to see the content of some variables etc

1 Like

Thanks for the suggestion Andreas. As I have developed a couple of scripts that are quite complicated, I was mainly hoping to get errors from JS such as reference to a variable that is undefined (and the line number).

Maybe I'll create a floating web view just for debugging that runs the same JS code after BTT initialization and that will exit the view upon successful completion.

I'm LOVING the product!

I'll check if I can automatically log errors!

BTT is great for smaller scripts, especially as it's easy to inline js and call BTT scripts from elsewhere.

But for complicated scripts I suggest creating Alfred Workflows, and then trigger them from BTT with the relevant arguments. It helps keep BTT clean as well.

You can call BTT from Alfred using btt://
Which is much cleaner than Alfreds approach, as alfred:// is not used for triggering workflows, and applescript is used instead: External Triggers - Alfred Help and Support

These two tools go very well in hand. Of course you loose some perfomance by calling back and forth, but as with many other tools, utilising multiple has great benefits