Jump to content
Macro Express Forums

IF clipboard contains...

Recommended Posts

I have a command that is



When I run my macro I want to know if the clipboard contains

text.  sometimes I want to know if it contains TEXT1 or TEXT2 or TEXT3...


I set the macro to prompt for the value and set / store as a variable...


Do I have to prompt 3 times and store as 3 different variables?

Or is there a format to enter the test so that ME knows what I am looking for?


ie.  I want to see if clipboard contains ABC   or   DEF   or   GHI.

When prompt 1 comes up can I enter ABC Prompt 2 DEF etc...



IF I create the macro so that it prompts 3 times and I only have two identifiers  (ABC and DEF)

when I leave the third prompt blank is that going to set off a false positive to the macro

because my code would read






IF CLIPBOARD CONTAINS VAR3 (I left blank at prompt)


The macro would read VAR3 as blank and every clipboard copy would have blank space


Is there a clean / neat way to put in multiple values for IF CLIPBOARD BONTAINS?


I hope this makes sense...





Link to comment
Share on other sites

In your example, you don't know if VAR3 will have a blank space or will be null.  I don't know either. 

Try your prompt in a test macro, then use TEXT BOX to display >>>%VAR3%<<<.

If the display shows as >>>  <<<, you know it is blank.  If the display shows as >>><<< then VAR3 is null. 

If VAR3 is blank after the prompt, you can use VARIABLE SET STRING to set it null -- just enter nothing in the value field of VARIABLE SET STRING.


Next thing to check, in a test macro, is what happens when you say (with VAR3 null) IF CLIPBOARD CONTAINS %VAR3% ....  Again, display your result with a text box.


   TEXT BOX DISPLAY "Contains null"


   TEXT BOX DISPLAY "Does not contain null"


Sometimes it is not obvious how Macro Express will work, and if you can't find your situation in the Help section, testing like this is the quickest way to figure it out.

Link to comment
Share on other sites

There's no multi-field input box. 
If you loop you can use the text or cancelation to end the loop. Like if it's empty, the user types "cancel", or you can use the "On Error" to handle the "Dialog was cancelled" exception. 

Depending on how many you want, I would use the multiline version of the Variable Set prompt command and then split each into a different variable. COunt how many there were and save that in a variable to control whatever loops you're using later. The variables shoudl then be saved as an array variable. Define it to be 99 elements or whatever you think sufficient. 

THis is a good opportunity to suggest you create your own named variables and not use the legacy "T" variables. 

Link to comment
Share on other sites


Lets start by saying if you guys keep this up I am going to owe ALOT of dinners!!!

(just let me know when you are in the Chicagoland area!!!)


Thanks for the suggestions. 

I actually do like to TEST things out...  I hope that is obvious by me including

my commands in my posts (I am not looking for someone else to do the work...)

but when a test doesn't go well, I am not sure why and if the mistake is something

that I was missing ie an unknown command or something stupid that I entered wrong.


I do appreciate the advice and I will be in front of the computer ALL WEEKEND LONG...


as Arnold said...   I'LL BE BACK!!!😄





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.

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.

  • Create New...