I often want to paste output to Excel. So I’ve written this function toclip below.
Is it possible to call this function automatically when a code block is executed via CTRL+Enter.
thank you.
The below uses ${selectedText}. It works when the code is selected. When I hit CTRL+Enter within a function or other code block, Julia executes the whole block. is it possible to get this block as a variable like selectedText ?
toclip.jl
function execute_and_clip(expr)
result = eval(Meta.parse(expr))
toclip(result)
return result
end
I think Lincoln’s point is mostly about having this run automatically in VSCode. To answer your question, given that this is something that 99% of users won’t need it strikes me as unlikely that this would be set as default in VSCode (I certainly would find it odd if stuff was automatically put on the clipboard), but you can certainly make a PR to the VSCode extension to see if the devs are up for it.
Thanks Peter. This is a nice package I wasn’t aware of.
I prefer my approach though of one function, multiple methods. Seems a pity not to use Julia’s famous feature.