mavi55 Posted June 30, 2017 Report Share Posted June 30, 2017 Hello, my friends, this is my first post in this great community, so if you are in the wrong place, I apologize. I need your help, For example, I have a variable that contains the text "user with code BQ", I need the code "BQ", however it can appear anywhere in the text. What I've been trying to find is the code to isolate the code "BQ" but i fail, that's it ... does anyone have any ideas? XD My macro is version 4.7.1.1. Quote Link to comment Share on other sites More sharing options...
Cory Posted June 30, 2017 Report Share Posted June 30, 2017 What about the string is distinctive? If you tasked a human to do it manually, how would you describe it? IE what rule would you give them? Quote Link to comment Share on other sites More sharing options...
rberq Posted June 30, 2017 Report Share Posted June 30, 2017 Variable Set Integer %N1% from Position of Text in Variable %T1% (search for "user with code ") That gives you the displacement within the variable of the text "user with code ". Add 15 to the value in N1, and you have the starting position within the text of the two-character code. Extract the characters into another variable with Variable Modify String: Copy Part of %T1% to %T2% (starting position N1, characters to copy 2) If I have misunderstood what you want, then give us some examples of text you are working with, and the codes you are trying to isolate. 1 Quote Link to comment Share on other sites More sharing options...
acantor Posted July 1, 2017 Report Share Posted July 1, 2017 Maybe this? If Variable %x% Contains "BQ" Or this? Text Type (Simulate Keystrokes): <CONTROL>c // Copy text to clipboard... If Clipboard Contains "BQ" Quote Link to comment Share on other sites More sharing options...
mavi55 Posted July 7, 2017 Author Report Share Posted July 7, 2017 On 30/06/2017 at 5:04 PM, rberq said: Variable Set Integer %N1% from Position of Text in Variable %T1% (search for "user with code ") That gives you the displacement within the variable of the text "user with code ". Add 15 to the value in N1, and you have the starting position within the text of the two-character code. Extract the characters into another variable with Variable Modify String: Copy Part of %T1% to %T2% (starting position N1, characters to copy 2) If I have misunderstood what you want, then give us some examples of text you are working with, and the codes you are trying to isolate. Thank's very much to all of you!!! rberq, Perfect you resolved my problem !!! 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.