Delete [EXTRACT] written when copying two lines Imacros

你。 提交于 2020-01-05 05:57:15

问题


adress1
adress2

When copying and pasting two lines of text as above.

adress1[EXTRACT]adress2

But I would like to paste this as below. Please teach me.

adress1
adress2

I am using: Chrome 70.0.3538.102 Win10_x64 imacros10.0.5forCR (free)


回答1:


Yep, when doing several Extracts, iMacros will separate them using this '[EXTRACT]' Separator, that when saving the Content to a '.CSV' using the 'SAVEAS' Command, will be converted to the '.CSV' Separator, usually a Comma.

Using 'EVAL()' + 'replace()' usually, you can replace it with whatever you want...
Instead of 'replace()', I prefer to use 'split()' like I had already mentioned in your previous Qt to achieve the Equivalent to a Global 'replace()' (that would require REGEX) and that will keep working even if you have more than 2 Addresses...:

SET !EXTRACT adress1[EXTRACT]adress2
SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var z=s.split('[EXTRACT]').join('<BR>'); z;")
PROMPT EXTRACT:<BR>_{{!EXTRACT}}_<BR><BR>Addresses:<BR>_{{!VAR1}}_

(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10_x64.)

EDIT:
And to include the Case of '#EANF#' (xN) and in any Position => See Content of '!VAR2' in the 'PROMPT':

'SET !EXTRACT adress1[EXTRACT]adress2
'SET !EXTRACT #EANF#[EXTRACT]adress2
'SET !EXTRACT adress1[EXTRACT]#EANF#
'>
'SET !EXTRACT address1[EXTRACT]address2[EXTRACT]address3
'SET !EXTRACT #EANF#[EXTRACT]address2[EXTRACT]address3
'SET !EXTRACT address1[EXTRACT]#EANF#[EXTRACT]address3
SET !EXTRACT address1[EXTRACT]address2[EXTRACT]#EANF#

SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var z=s.split('[EXTRACT]').join('<BR>'); z;")
SET !VAR2 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('#EANF#[EXTRACT]').join(''); y=x.replace('[EXTRACT]#EANF#',''); z=y.split('[EXTRACT]').join('<BR>'); z;")
PROMPT EXTRACT:<BR>_{{!EXTRACT}}_<BR><BR>Addresses_VAR1:<BR>_{{!VAR1}}_<BR><BR>Addresses_VAR2:<BR>_{{!VAR2}}_

(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10_x64.)

Notice the use of 'replace()' for 'y', I could have used 'split().join()' again also but all but an eventual final '#EANF#' should have already been "handled" by the 'x' part, then a simple 'replace()' is "good enough" to handle that last '#EANF#'.

See and reactivate all 'SET !EXTRACT' Lines to test different Cases and different possible Positions for '#EANF#'.



来源:https://stackoverflow.com/questions/53463981/delete-extract-written-when-copying-two-lines-imacros

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!