ikodan Posted April 19, 2021 Report Share Posted April 19, 2021 Hello, I'm not beginner with ME 4.9.1 but I never done this before. I want to treat a page where is 15 times this kind of data : Quote Ceinture de Bloublou Niveau 160 @DonarX11 Michto : Kipu Orkou IV400 X 1 =400 Il y a 15 Heure Icône I want to trim this text in order to keep only one of the two numbers I underlined. Every text in each line can change, except "X" and "=", but I just want to keep one of the two "400" in this exemple. I need this in order to refresh the entiere text, compare the one before, and the one after, and ring if there is a difference. But I'm able to do this part. Thank you for help. Quote Link to comment Share on other sites More sharing options...
terrypin Posted April 19, 2021 Report Share Posted April 19, 2021 Hi, Perhaps because I have not yet had my first coffeee, but I’m not clear about the result you want from that example. I assume I this is your INPUT: Ceinture de BloublouNiveau 160@DonarX11Michto : KipuOrkou IV400 X1 =400 Il y a 15 HeureIcône So is your OUTPUT this? Ceinture de BloublouNiveau 160@DonarX11Michto : KipuOrkou IV400 X1 = Il y a 15 HeureIcône Or this? Ceinture de BloublouNiveau 160@DonarX11Michto : KipuOrkou IVX1 =400 Il y a 15 HeureIcône Or this? Ceinture de BloublouNiveau 160@DonarX11Michto : KipuOrkou IV400 X1 =Icône Or this? Ceinture de BloublouNiveau 160@DonarX11Michto : KipuOrkou IV400 X1 = Il y a 15 HeureIcône Or something else? Terry Quote Link to comment Share on other sites More sharing options...
acantor Posted April 19, 2021 Report Share Posted April 19, 2021 1. I think you are saying that you want the macro to examine 15 blocks of text, and that each block is in this 11-line format: Ceinture de Bloublou Niveau 160 @DonarX11 Michto : Kipu Orkou IV400 X 1 =400 Il y a 15 Heure Icône 2. Can you express the number you are monitoring as a range? For example, the number you are looking for can have these values: minimum value: 100 maximum value: 999 3. Where will these blocks of text be located? In a database? In a plain text file? In a Word document? In a spreadsheet? Quote Link to comment Share on other sites More sharing options...
ikodan Posted April 19, 2021 Author Report Share Posted April 19, 2021 terrypin it's like acantor says. acantor : the value can be from 1 to 999999. The text with all blocks is located on a variable or a text file. thank you. Quote Link to comment Share on other sites More sharing options...
terrypin Posted April 19, 2021 Report Share Posted April 19, 2021 To remove all ambiguity why don't you simply show two examples of the input and output? Quote Link to comment Share on other sites More sharing options...
ikodan Posted April 19, 2021 Author Report Share Posted April 19, 2021 10 minutes ago, terrypin said: To remove all ambiguity why don't you simply show two examples of the input and output? Ceinture de Bloublou Niveau 160 @DonarX11 Michto : Kipu Orkou IV 400 X 1 = 400 Il y a 15 Heure Icône Ceinture de RATRRR Niveau 160 @Zfeee eeffff: ttrrr Ertzzy 525 X 4 = 2100 Il y a 16 Heure Icône Become : 400, 525 Or 400, 2100 Thank you. Quote Link to comment Share on other sites More sharing options...
Cory Posted April 19, 2021 Report Share Posted April 19, 2021 I woudl use Text File Process to go though each line. On the 6th and 10th line and each interval there after I'd find the first occurrence of the space and take only the characters up to that. So if the space was at 4, take the substring 1 though 3. This is assuming the line counts are consistent. Quote Link to comment Share on other sites More sharing options...
ikodan Posted April 19, 2021 Author Report Share Posted April 19, 2021 3 minutes ago, Cory said: I woudl use Text File Process to go though each line. On the 6th and 10th line and each interval there after I'd find the first occurrence of the space and take only the characters up to that. So if the space was at 4, take the substring 1 though 3. This is assuming the line counts are consistent. That's not 😁 Quote Link to comment Share on other sites More sharing options...
ikodan Posted April 19, 2021 Author Report Share Posted April 19, 2021 Do you know how I can remove a line when I know the text inside, and how can I put a line number 12 into a variable ? Quote Link to comment Share on other sites More sharing options...
acantor Posted April 19, 2021 Report Share Posted April 19, 2021 If the organization of lines is not consistent, then this will be a very challenging project! Is there always a line that starts with the word "Niveau?" Can we always ignore the number on that line? Does the time always appear? (E.g., "Il y a 16 heures") Can we always ignore the time? If a number appears on a line by itself, can we always ignore that number? Quote Link to comment Share on other sites More sharing options...
ikodan Posted April 19, 2021 Author Report Share Posted April 19, 2021 Sorry, maybe I have a easier way : 1 - Is it possible to keep a text between 2 words ? For exemple : xoops hello blablabla 51616 Keep only "hello blablabla" 2 - Is the new version of macro express able to monitor changes visualy on a web page ? Quote Link to comment Share on other sites More sharing options...
acantor Posted April 19, 2021 Report Share Posted April 19, 2021 56 minutes ago, ikodan said: 1 - Is it possible to keep a text between 2 words ? For exemple : xoops hello blablabla 51616 Keep only "hello blablabla" Yes... but you must know, or be able to calculate, the position of "hello blablabla" within the string. Does it always appear on a certain line? If yes, which line? Does "xoops" always appear before and "51616" always appear afterwards? Does the "H" in "hello blablabla" always appear as the n-th character in the string? Quote Link to comment Share on other sites More sharing options...
ikodan Posted April 19, 2021 Author Report Share Posted April 19, 2021 I was hopping that I could process between X and =. Nvm... Quote Link to comment Share on other sites More sharing options...
acantor Posted April 19, 2021 Report Share Posted April 19, 2021 No problem capturing the text between "X" and "=". But for this approach to work, you must make sure that "X" and "=" only appear once in the string. The code might look something like this: Variable Set String %Data% to "Ceinture de Bloublou Niveau 160 @Donarx11 Michto : Kipu Orkou IV 999 X 12345 = 140 Il y a 15 Heure Icône" Variable Modify String: Replace " " in %Data% with "" // I don't think we need the spaces Variable Set Integer %PositionX% to the position of "X" in %Data% Variable Modify Integer: %PositionX% = %PositionX% + 2 Variable Set Integer %PositionEquals% to the position of "=" in %Data% Variable Modify Integer: %PositionEquals% = %PositionEquals% - 1 Variable Modify Integer: %CharactersToCopy% = %PositionEquals% - %PositionX% Variable Modify String: Copy part of text in %Data% starting at %PositionX% and %CharactersToCopy% characters long to %Data% Text Box Display: Result <VARIABLE SET STRING Option="\x00" Destination="%Data%" Value="Ceinture de Bloublou\r\nNiveau 160\r\n@Donarx11\r\nMichto : Kipu\r\nOrkou IV\r\n999 \r\nX\r\n12345 \r\n=\r\n140 Il y a 15 Heure\r\nIcône" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%Data%" ToReplace=" " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE" _COMMENT="I don't think we need the spaces"/> <VARIABLE SET INTEGER Option="\x0E" Destination="%PositionX%" Text_Variable="%Data%" Text="X" Ignore_Case="FALSE"/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%PositionX%" Value1="%PositionX%" Value2="2"/> <VARIABLE SET INTEGER Option="\x0E" Destination="%PositionEquals%" Text_Variable="%Data%" Text="=" Ignore_Case="FALSE"/> <VARIABLE MODIFY INTEGER Option="\x01" Destination="%PositionEquals%" Value1="%PositionEquals%" Value2="1"/> <VARIABLE MODIFY INTEGER Option="\x01" Destination="%CharactersToCopy%" Value1="%PositionEquals%" Value2="%PositionX%"/> <VARIABLE MODIFY STRING Option="\x09" Destination="%Data%" Variable="%Data%" Start="%PositionX%" Count="%CharactersToCopy%" NoEmbeddedVars="FALSE"/> <TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang4105\\f0\\fs20 %PositionEquals% - %PositionX% = %CharactersToCopy%\r\n\\par \r\n\\par [%Data%]\\lang1033\\f1\\fs14 \r\n\\par }\r\n" Left="5" Top="417" Width="1719" Height="294" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> Quote Link to comment Share on other sites More sharing options...
ikodan Posted April 19, 2021 Author Report Share Posted April 19, 2021 Thank you for your help, I'll take a look at this. 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.