Is there an alternative solution to short pauses between Selecting and Copying?

I've had to put short pauses in-between triple clicking to select and copying to make my macros work, eventually I hope to expand beyond this method but for now I was curious if there was a better solution than short pauses, it's only a minor inconvenience but it would be good to know. If not is there a length of pause that you all have found sufficient?

Random thought: Depending on where you're getting the data from you might be able to use javascript or applescript or browser actions to grab the data without having to select and copy it.

Definitely want to do this eventually but it's beyond my capabilities at the moment unfortunately

I generally look for a menu item Edit » Select All and use that before copying, with the expectation that once “Select All” has run, I can do cut/copy and know that I will be getting everything I'm looking for.

HTH.

Yes. See:

MACRO: [CB] How to Detect When Clipboard Has Changed

3 Likes

Thanks, would you be kind enough to help me understand how I would implement it into my process of Triple Click, Copy? Do I execute your macro within my macro at some point?

You could do that, or you could surround the "Copy" action with the two clipboard seed related actions like this:

image

3 Likes

Perhaps you did not see this at the top of my topic:

which provide a direct example you should be able to use to build your own:

image

1 Like

Nice, does this still work with named clipboards?

You know, I'd never actually tried before you asked (I pretty much only use variables and the system clipboard myself) but after a quick test, it seems that it does indeed work with named clipboards as well.

1 Like

Had the same question. Especially since several macros that worked in 9.0 are broken in 9.0.1.

The clipboard trick looks promising! Going to experiment with that.

There should be no need for any pause in that sequence, since they are all events that go into the event queue. Unless the application is poorly behaved, they should be processed in order.

Is it an issue with a specific application?

The Copy action already does the “pause until clipboard changes”, you don't need to do that yourself.

My experience has been that the copy action times out ~10% of the time if there's no pause. However, maybe I forgot to mention one key distinction which is that I'm using "copy to named clipboard" not just copy, does that work differently? After reading the description in the wiki that seems to be the case

Just tried it out with just the copy action and it still times out once out of every x tries. It could be something to do with the website I'm working with.

Copy, and Copy to Named Clipboard, do the same thing, basically:

  • Type a ⌘C
  • Pause until the clipboard changes

Both have a default timeout of 10 seconds, which is extreme already - if the clipboard has not changed in 10 seconds, then unless you are copying something extremely complex, it is never going to change.

But if you are seeing this resolved by adding a pause, then maybe extending the timeout will help, but it seems very odd to me.

You say 'Macros' in the plural. I had a similar though not identical problem and I had several macros with no stop conditions waiting, so to speak, for imputs so they were really running all the time? I don't know how much resource that consumes. Several 'if then' ones which I eventually deleted or put 'stop macro' on in various ways; that solved it. I don't know what goes on under the hood and wonder if what I describe could really consume resources? I found a similar thing to what you describe happens when my battery is very low too, I can't really analyse it beyond this shot in the dark though, I don't understand it well enough.

Isn't it possible that the clipboard will change prior to the "pause until the clipboard changes" action (but after the Type CMD-C action) in your example above? I was just having a discussion about this very topic with someone in another thread.

It would be, except that it starts detecting changes to the clipboard before simulating the ⌘C. If you want to be pedantic, it is something like (as you can build yourself with actions)

Oh, I wasn't trying to be pedantic, I sincerely didn't realize that that's what you meant when you wrote: