stevecasper Posted May 23, 2009 Report Share Posted May 23, 2009 Hey all. I am curious how many people use a "Clipboard Copy snippet," or any series of commands in conjunction with Clipboard Copy in order to guarantee that the clipboard is acquiring information before the macro moves on. I know that this has been discussed a little bit in the past, but I am considering making a formal feature request for a Clipboard Copy option keeping the macro from moving on until the clipboard <> "". In case anybody is wondering, and in case somebody has a smoother way of doing this, here is my simple snippet: Clipboard Copy Repeat Until %Forever% Does not Equal "%Forever%" If Clipboard Equals "" Delay: .05 seconds Else Repeat Exit End If End Repeat And here is my complex snippet (for those applications that are highly irregular in their timing): Clipboard Copy Repeat Start (Repeat 10 times) // Storing counter in %N[1]% If Clipboard Equals "" Delay: .05 seconds Else Repeat Exit End If If Variable %N[1]% Equals "10" Repeat Start (Repeat 10 times) Clipboard Copy If Clipboard Equals "" Delay: .05 seconds Else Repeat Exit End If End Repeat End If End Repeat So far I haven't had to build a third tier of "If clipboard is still empty..." Quote Link to comment Share on other sites More sharing options...
acantor Posted May 24, 2009 Report Share Posted May 24, 2009 I understand the appeal of running a check to ensure that the clipboard is empty before moving on. But from a practical standpoint, it may be as fast -- and maybe faster -- to add a fixed delay. Adding a delay is not as elegant as testing that an event has occurred, but in the end, I think it's OK if the script works reliably enough. A macro that has no ability to act upon programmatic information from the application or OS cannot be 100% reliable; but it can come close. This reminds me of a dilemma I faced recently. I was creating a virtual keyboard interface for a mouse-intensive, non-standard application. I strive to make macros that are fast, reliable, portable, intelligible, and inconspicuous. Sometimes a trade-off is necessary. To make these macros (almost) 100% reliable, I could send long series of keystrokes. But it made the screen very "flashy" and was a tad slow. In the end, I opted to cause the scripts to click on controls, which required two lines of code (move mouse, click mouse) rather than eight or ten (text type this... text type that...) It irritated me that these scripts were not portable and potentially unreliable, but in the end, speed, intelligibility, and non-conspicuousness won out. Quote Link to comment Share on other sites More sharing options...
stevecasper Posted May 24, 2009 Author Report Share Posted May 24, 2009 I understand the appeal of running a check to ensure that the clipboard is empty before moving on. But from a practical standpoint, it may be as fast -- and maybe faster -- to add a fixed delay. The problem isn't making sure the clipboard is empty, but rather making sure the clipboard is not empty. Adding a fixed delay is not particularly reliable, unless you use an extensive delay, and then it is not likely to be faster than a .05 second delay repeated until the clipboard registers the copy. I've used fixed delays, because it's just one line of code, but if the delay is too short, and the application (or computer for that matter) is running at inconsistent speeds, then the macro moves along without the required information stored in the clipboard (and therefore variable set from clipboard contents). If the delay is too long, then we have the problem of the macro appearing to hang, or possibly just not being faster than performing the function manually. Mostly I'm thinking of making a Feature Request for the Clipboard Copy function to have an option to "Wait until clipboard is not empty", or something along those lines. That would avoid both the need for extensive delays (or unreliable delays) as well as extensive code double-checking the clipboard contents. I just wonder if I'm alone in this desire. Quote Link to comment Share on other sites More sharing options...
acantor Posted May 24, 2009 Report Share Posted May 24, 2009 Mostly I'm thinking of making a Feature Request for the Clipboard Copy function to have an option to "Wait until clipboard is not empty", or something along those lines. That would avoid both the need for extensive delays (or unreliable delays) as well as extensive code double-checking the clipboard contents. I just wonder if I'm alone in this desire. I second that! Wait until Clipboard Is Empty Wait until Clipboard Is Not Empty Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.