Slow clipboard updating?

Has anyone else run into a situation where you have to add delays to allow the clipboard to update after you’ve copied something to it in an application? I am using System Events on a remote machine to copy a field into the clipboard, but if I don’t put a .5 delay after copying to the clipboard, but before setting my variable to the clipboard, the variable gets set to the previous clipboard value. Anyone else run into this? Any workarounds? I hate having to slow down my scripts…


I’ve had the same problem, but luckily mine involved pasting things into TextEdit, so I used:

tell application "TextEdit" to make new document with properties {text:"This is the text"}

Since you’re trying to get something instead of set it, why not use the application instead of the clipboard? As in,

set theText to text of document 1 of application "TextEdit"

I find that just going into Script Editor and typing something like ‘get properties of document 1 of application “Whatever”’ is good for finding terms for scripting. What app are you getting the text from? Maybe somebody else on this forum has it and can help you out.

The app I’m trying to get the text from is totally not Applescript aware, so I’m forced to use System Events and keystrokes. Oh well. Thanks for the suggestion. :slight_smile: