问题
I'm using iMacros 9 with Firefox, and I'm having a brutally difficult time doing a simple select-all, copy-paste.
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
TAG POS=1 TYPE=BUTTON ATTR=ID:share_on_stats
TAG POS=1 TYPE=BUTTON ATTR=TXT:comma-separated
##need to do select all, and copy here.
TAG POS=1 TYPE=DIV ATTR=ID:modal-close
TAB T=2
##need to paste what was copied here
##TAG POS=1 TYPE=TEXTAREA FORM=ID:myform ATTR=ID:paste_code CONTENT=ALL
TAB T=1
TAG POS=1 TYPE=A ATTR=TXT:Next<SP>page
Anyone have any suggestions? I've tried clipboard, "EVENTS TYPE=KEYPRESS CHARS=”a” MODIFIERS=”ctrl” and some selection codes but nothing seems to work. After the click into "comma-separated" the page puts me in a modal with a txt CSV i need to copy.
Thanks!
回答1:
One of the more common ways to perform this type of operation with iMacros is to extract the text you need to 'copy' using a TAG...EXTRACT command, and then use the extracted data, which gets stored in the !EXTRACT variable, in the CONTENT parameter of another TAG command that clicks the field you want to 'paste' into.
I'd recommend recording a click somewhere inside that modal that has the text you need, and then modify the command by adding EXTRACT=TXT to the end of it. Next, modify the TAG command for the textarea field like so:
TAG POS=1 TYPE=TEXTAREA FORM=ID:myform ATTR=ID:paste_code CONTENT={{!EXTRACT}}
c.f. How to copy-and-paste with iMacros
回答2:
Below I'd like to show you how to select-all, copy, and paste in iMacros:
TAB T=1
TAG POS=1 TYPE=BUTTON ATTR=ID:share_on_stats
TAG POS=1 TYPE=BUTTON ATTR=TXT:comma-separated
' perhaps a small wait for a modal to pop up
' ##need to do select all, and copy here.
' your selector instead of *
EVENT TYPE=KEYPRESS SELECTOR=* CHAR="a" MODIFIERS="ctrl"
EVENT TYPE=KEYPRESS SELECTOR=* CHAR="c" MODIFIERS="ctrl"
TAG POS=1 TYPE=DIV ATTR=ID:modal-close
TAB T=2
' ##need to paste what was copied here
TAG POS=1 TYPE=TEXTAREA FORM=ID:myform ATTR=ID:paste_code CONTENT={{!CLIPBOARD}}
' or this line with the paste event
'EVENT TYPE=KEYPRESS SELECTOR="#paste_code" CHAR="v" MODIFIERS="ctrl"
TAB T=1
TAG POS=1 TYPE=A ATTR=TXT:Next<SP>page
来源:https://stackoverflow.com/questions/42795325/how-to-select-all-copy-and-paste-in-imacros