Frank Posted June 3 Report Share Posted June 3 Macro does a CLIPBOARD COPY.. If clipboard contains... I want to search the clipboard and see if it contains a specific number in my example I am looking to see if the number 201 or 202 or 203 or 204... 299 is in the clipboard. Do I have to set up 99 variables and and 99 lines of code to accomplish this? set variable a to 201 set variable b to 202 etc and if clipboard contains "a" or if clipboard contains "b" etc Can this be done easier / cleaner? Thanks Frank Quote Link to comment Share on other sites More sharing options...
acantor Posted June 3 Report Share Posted June 3 This might be easier using RegEx, but maybe something like this? Text Type (Simulate Keystrokes): <CONTROL>c Variable Set String %Clip% from the clipboard contents Variable Set Integer %Values% to 200 Repeat Start (Repeat 100 times) If Variable %Clip% Contains "%Values%" Text Box Display: %Values% End If Variable Modify Integer %Values%: Increment End Repeat Quote Link to comment Share on other sites More sharing options...
Cory Posted June 3 Report Share Posted June 3 No examples were given of the clipboard contents, but often a string like that would appear in the same place. So if one could get the exact position, then extract the 3 characters to a new string variable, then cast that to an integer. Now one can evaluate it mathematically using greater/less than. Another tack might be to act like one's own RegEx Engine. Start at the first character and evaluate each character. Then have a logic trap with three levels. Default Boolean variable would be false, then if it makes it to the bottom of the logic trap, change to true and advance. If Character is "2" If Character is between 0-9 If Character is between 0-9 True and abort loop EndIf EndIf EndIf Bear in mind that doing a string evaluation works like a numeral. The string 5 is greater than the string 4. Zero to nine is 0x31 to 0x39, To make the evaluation easier I would say use foreslash 0x30 and colon 0x3A to make it greater than and not have to add "equals to". 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.