Jump to content
Macro Express Forums

Faster test for empty clipboard


Recommended Posts

The standard test for an empty clipboard

If Clipboard Equals ""

 

seems to take much longer than this alternative, assuming T1 holds the selected text.

 

Variable Set Integer %N[1]% to the length of variable %T[1]%
If Variable %N[1]% Equals "0"

In some lengthy iterations that approach might produce a useful speed improvement?

 

Is my assumption correct, that only an empty string has a length of zero?

 

 

--
Terry, East Grinstead, UK

Link to comment
Share on other sites

  • 3 weeks later...

The same holds true for VisualBasic 6. I always use the command If Len(variable) = 0 Than.

Numeric compare are much faster than string compare. I don't know what language Macro Express was created with but I guess the same holds true for that complier.

Link to comment
Share on other sites

It's not the comparison that takes up a lot of time. It's the speed of the process of inducting the contents of the clipboard. MEP does not simply grab the contents but rather there is a routine that does some sort of checking or something to make it more stable for the user. Also the Windows Clipboard itself and lag at times.

 

As an asside MEP is written in Delphi. Also in VB I find the string.isnullorempty() or string.isnullorwhitespace() to be very quick.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...