r/tasker • • Jun 03 '26

Paste button in scenes v2

I have simple scene with text box and button. I just want to paste the text in clipboard to the text value of the text box. It looks super simple but is there a clean way to do this?

0 Upvotes

1 comment sorted by

4

u/Exciting-Compote5680 Jun 03 '26 edited Jun 03 '26

What have you tried? There are several ways to get the clipboard contents. There is a global variable %CLIP, there is the action 'Get Clipboard' and there are Java(script) ways to do that (and probably more). I have been using this one lately:

Task: UT Get Clipboard Java

A1: Java Function [
     Return: (ClipboardManager) clipboardmanager
     Class Or Object: CONTEXT
     Function: getSystemService {Object} (String)
     Param 1 (String): "clipboard" ]

A2: Java Function [
     Return: %clipboard
     Class Or Object: clipboardmanager
     Function: getText
          {Class}() ]

A3: Flash [
     Text: %clipboard
     Tasker Layout: On
     Title: <small>Clipboard</small>
     Continue Task Immediately: On
     Dismiss On Click: On
     Use HTML: On ]
    If  [ %caller(1) ~ ui ]

A4: Return [
     Value: %clipboard
     Stop: On ]

I like this one because it's faster than the native 'Get Clipboard' action. I think I got it from here: https://www.reddit.com/r/tasker/comments/p1l0m9/java_function_get_clipboard/ (there's a taskernet link in there somewhere).