Reading clipboard in a script

Tagged: 

Viewing 6 reply threads
  • Author
    Posts
  • October 6, 2018 at 12:06 PM #30930

    Martin Kendall
    Participant

    Is it possible for a JavaScript script to read the iOS clipboard?

    I like to quickly note new entries in plain text in other apps (e.g. Drafts). I know there isn’t a full Tap Forms URL scheme at the moment, but the ability to run a form script that creates a record from the clipboard contents would be fantastic.

    I hope it is possible,

    Martin
    Ps Setting the clipboard too would be great to send data to other apps, but that is of lesser importance

    October 6, 2018 at 10:32 PM #30934

    Brendan
    Keymaster

    Hi Martin,

    I haven’t written any code to enable access to the clipboard. I’m not sure that JavaScript directly allows that so I would have to write some Objective-C code that allows access to it.

    Thanks,

    Brendan

    October 7, 2018 at 6:52 AM #30940

    Martin Kendall
    Participant

    That’s a shame. Fingers crossed you can add it someday.

    I did think of trying promptForInputParameters and then pasting in my clipboard. Sadly this doesn’t seem to work on the iPad. I also couldn’t get alertWithMessage to work on the iPad.

    Are only a subset of functions supported on the iOS version?

    Thanks

    Martin

    October 7, 2018 at 5:30 PM #30943

    Brendan
    Keymaster

    Hi Martin,

    The promptForInput function was an old function that is no longer there for Mac or iOS. I inadvertently forgot to update the manual with the new Prompter() class API. I’ve fixed the documentation for that now. But I still have to implement that on the iOS version

    The Utils.alertWithMessage('Script Run Complete!', 'Cool!!!!!'); function should work on iOS though. I just tested it and it does work.

    Thanks!

    Brendan

    October 7, 2018 at 11:15 PM #30946

    Martin Kendall
    Participant

    Thank you. I have tried:

    Utils.alertWithMessage("almost done", record);

    And it puts up a dialog box, but the script doesn’t continue after pressing OK.

    Is it only intended to be used at the end of a script?

    October 7, 2018 at 11:27 PM #30949

    Brendan
    Keymaster

    Yes that’s right. It’s good for showing the results of running a script. It’s displayed asynchronously after the script executes.

    October 7, 2018 at 11:27 PM #30950

    Martin Kendall
    Participant

    Actually the script does seem to be running, but a second call to alertWithMessage isn’t showing, nor is the final “success” dialog.

    I will have to investigate further.

Viewing 6 reply threads

You must be logged in to reply to this topic.