[SOLVED] My script pastes the text “CONTENT={{!CLIPBOARD}}” rather than the actual clipboard contents?

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Keybit
Posts: 12
Joined: Thu Nov 28, 2019 2:21 pm

[SOLVED] My script pastes the text “CONTENT={{!CLIPBOARD}}” rather than the actual clipboard contents?

Post by Keybit » Thu Nov 28, 2019 2:33 pm

1. What version of iMacros are you using?
VERSION BUILD=10.0.2.1450 (freeware)

2. What operating system are you using? (please also specify language)
Windows 10 64bit English

3. Which browser(s) are you using? (include version numbers)
Firefox 70.0.1

4. Do the included demo macros work ok?
Yes

5. If reporting a problem with the iMacros scripting interface, please also test if the included VBS sample scripts run ok.
N/A

6. If recording or replay fails on a specific website: Can you please post the URL of the web page and/or the macro that creates the problem?
The page I am trying to paste to is an eBay UK create new listing page, I believe though this is not page specific as all other iMacro functions work on this page for me.

7. Do you encounter the same problem recording or replaying the macro in different browsers, such as the iMacros browser, Firefox, Chrome, or Internet Explorer?
Tyring to use firefox.

8. Please include any additional information that is relevant to reproducing the issue.
I am trying to get iMacros for Firefox to copy/paste data, the copying side is working (as confirmed by iMacros pop-ups) but when pasting instead of pasting the clipboard contents its actually pasting "CONTENT={{!CLIPBOARD}}" (without the quotation marks)

This is my script..

Code: Select all

FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivsml EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!CLIPBOARD}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
Any help greatly appreciated.

Here is a screenshot of the results it pastes in..
OnPaste.20191128-122328.png
OnPaste.20191128-122328.png (2.62 KiB) Viewed 212 times
I have read many other posts and searched you forums/Google/StackOverflow trying many of the suggestions without luck before posting this, I have also posted the same question on StackOverflow but whichever provides the answer first I will paste (with credit) into the other to possibly help others in future.

Thank you in advance for your time reading this and any help given.

Kind Regards
Glen Keybit.
Last edited by Keybit on Thu Jan 09, 2020 7:58 am, edited 1 time in total.
chivracq
Posts: 8871
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: My script pastes the text “CONTENT={{!CLIPBOARD}}” rather than the actual clipboard contents?

Post by chivracq » Thu Nov 28, 2019 6:56 pm

Keybit wrote:
Thu Nov 28, 2019 2:33 pm

Code: Select all

1. What version of iMacros are you using?
[b]VERSION BUILD=10.0.2.1450 (freeware)[/b]

2. What operating system are you using? (please also specify language)
[b]Windows 10 64bit English[/b]

3. Which browser(s) are you using? (include version numbers)
[b]Firefox 70.0.1[/b]
4. Do the included demo macros work ok?
Yes

5. If reporting a problem with the iMacros scripting interface, please also test if the included VBS sample scripts run ok.
N/A

6. If recording or replay fails on a specific website: Can you please post the URL of the web page and/or the macro that creates the problem?
The page I am trying to paste to is an eBay UK create new listing page, I believe though this is not page specific as all other iMacro functions work on this page for me.

7. Do you encounter the same problem recording or replaying the macro in different browsers, such as the iMacros browser, Firefox, Chrome, or Internet Explorer?
Tyring to use firefox.

8. Please include any additional information that is relevant to reproducing the issue.
I am trying to get iMacros for Firefox to copy/paste data, the copying side is working (as confirmed by iMacros pop-ups) but when pasting instead of pasting the clipboard contents its actually pasting "CONTENT={{!CLIPBOARD}}" (without the quotation marks)

This is my script..

Code: Select all

FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivsml EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!CLIPBOARD}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
Any help greatly appreciated.

Here is a screenshot of the results it pastes in..

OnPaste.20191128-122328.png

I have read many other posts and searched you forums/Google/StackOverflow trying many of the suggestions without luck before posting this, I have also posted the same question on StackOverflow but whichever provides the answer first I will paste (with credit) into the other to possibly help others in future.

Thank you in advance for your time reading this and any help given.

Kind Regards
Glen Keybit.

Hum, Compliments for the "good Quality" for your OP, and in your parallel Thread on SOF as well, where you even also mention your FCI... (except that 'Free' is missing there)... But, I'm impressed...! :D

The following "simplified" Format for your FCI is also OK...: :wink:

Code: Select all

iMacros for FF v10.0.2 'Free', FF v70.0.1, Win10_x64_ENG.
>>>

OK, hum, looks like a Bug to me, but '{{!CLIPBOARD}}' has always been a bit Buggy in iMacros for FF when the Clipboard is "empty" ("NULL" or "Not defined, doesn't have any Content"...) or contains an empty String, which in return offers some "interesting" unexpected Behaviour that allowed me once to post a Solution for a "Conditional 'PROMPT'" in this Thread... :oops:

But hum, you mention getting a Popup for the 'Copy' part, so I guess you mean the '!EXTRACT_TEST_POPUP' Popup upon doing the 'EXTRACT' on the 'resultsdivsml' Element... But if you want to later paste that Extract in the Input Field, you need to use "{{!EXTRACT}}" (and not "{{!CLIPBOARD}}")...:

Code: Select all

FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivsml EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
And yep, you could temporarily also first copy the Content of '!EXTRACT' to the OS Clipboard (or any Temp Var) to then paste from the Clipboard or from that Temp Var, but that would be an unnecessary extra Step...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Keybit
Posts: 12
Joined: Thu Nov 28, 2019 2:21 pm

Re: My script pastes the text “CONTENT={{!CLIPBOARD}}” rather than the actual clipboard contents?

Post by Keybit » Thu Nov 28, 2019 7:23 pm

But hum, you mention getting a Popup for the 'Copy' part, so I guess you mean the '!EXTRACT_TEST_POPUP' Popup upon doing the 'EXTRACT' on the 'resultsdivsml' Element... But if you want to later paste that Extract in the Input Field, you need to use "{{!EXTRACT}}" (and not "{{!CLIPBOARD}}")...:

Code: Select all

FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivsml EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add

And yep, you could temporarily also first copy the Content of '!EXTRACT' to the OS Clipboard (or any Temp Var) to then paste from the Clipboard or from that Temp Var, but that would be an unnecessary extra Step...
Thank you so much for your kind comments and help thus far, I was really hoping this reply was going to be a "thank you that fixed it" one but sadly not, although I suspect it's now just a case of somehow telling it to "forget" each EXTRACT after paste? and that it's my fault I didn't get a working solution first time round for only providing a section of the script and info on what I am trying to achieve.

So firstly here is the (now full and updated with the info you provided) script..

Code: Select all

VERSION BUILD=10021450
FRAME F=12
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=A ATTR=ID:msku-attribute-add
TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:msku-own-parent-tag-checkbox CONTENT=YES
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-parent-attribute-input CONTENT=Sticker<SP>Size
TAG POS=1 TYPE=BUTTON ATTR=ID:msku-add-parent-tag-btn
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-link
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivsml EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivstd EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivmed EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivlrg EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivxl EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivxxl EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
Now I'm definitely getting closer as it is now pasting the contents, however, as you can tell from the above script I failed to let you know that I'm trying to do several "EXTRACTS" in the same script and with your help to be fair it is almost now working!

However please see the attached screenshot which is my results now, note the "sticker size" options, and in this screenshot the last (SML 2x1mm) is the first in my script aka they are in reverse order. but as you can see the first now works as it should but all the ones after that get appended on to the last and plus "[EXTRACT]" seems to be added too each time..
stickersize problems.png
Thanks again in advance.
Keybit
Posts: 12
Joined: Thu Nov 28, 2019 2:21 pm

Re: My script pastes the text “CONTENT={{!CLIPBOARD}}” rather than the actual clipboard contents?

Post by Keybit » Thu Nov 28, 2019 7:33 pm

A tad more research and I think ive found it with

Code: Select all

SET !EXTRACT NULL
Testing now
chivracq
Posts: 8871
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: My script pastes the text “CONTENT={{!CLIPBOARD}}” rather than the actual clipboard contents?

Post by chivracq » Thu Nov 28, 2019 7:44 pm

Keybit wrote:
Thu Nov 28, 2019 7:23 pm
Thank you so much for your kind comments and help thus far, I was really hoping this reply was going to be a "thank you that fixed it" one but sadly not, although I suspect it's now just a case of somehow telling it to "forget" each EXTRACT after paste? and that it's my fault I didn't get a working solution first time round for only providing a section of the script and info on what I am trying to achieve.

So firstly here is the (now full and updated with the info you provided) script..

Code: Select all

VERSION BUILD=10021450
FRAME F=12
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=A ATTR=ID:msku-attribute-add
TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:msku-own-parent-tag-checkbox CONTENT=YES
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-parent-attribute-input CONTENT=Sticker<SP>Size
TAG POS=1 TYPE=BUTTON ATTR=ID:msku-add-parent-tag-btn
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-link
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivsml EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivstd EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivmed EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivlrg EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivxl EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivxxl EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
Now I'm definitely getting closer as it is now pasting the contents, however, as you can tell from the above script I failed to let you know that I'm trying to do several "EXTRACTS" in the same script and with your help to be fair it is almost now working!

However please see the attached screenshot which is my results now, note the "sticker size" options, and in this screenshot the last (SML 2x1mm) is the first in my script aka they are in reverse order. but as you can see the first now works as it should but all the ones after that get appended on to the last and plus "[EXTRACT]" seems to be added too each time..
stickersize problems.png

Thanks again in advance.

Ah...!, yep indeed, normal Behaviour, ah-ah...!, and by Design...

If you only do 1 'EXTRACT' in your Script, or for the very 1st one, the '!EXTRACT' Built-in Var which is storing all 'EXTRACT' Commands is already "empty", but if you do several 'EXTRACT''s in your Script and what to paste them "individually" one by one, then you first need to "reset" the '!EXTRACT' Var with "SET !EXTRACT NULL" just before every (new) 'EXTRACT'..., which will give stg like...:

Code: Select all

VERSION BUILD=10021450
FRAME F=12
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=A ATTR=ID:msku-attribute-add
TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:msku-own-parent-tag-checkbox CONTENT=YES
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-parent-attribute-input CONTENT=Sticker<SP>Size
TAG POS=1 TYPE=BUTTON ATTR=ID:msku-add-parent-tag-btn
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-link

TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivsml EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add

TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivstd EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add

TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivmed EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add

TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivlrg EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add

TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivxl EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add

TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivxxl EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
The very first "SET !EXTRACT NULL" is not "really" needed (as the '!EXTRACT' Var is then still empty at that moment), but it doesn't "hurt" and i consider it "Good Practice" actually, in case you later want to shuffle a bit the Order of several Blocks or if you later add some extra Block before that 1st one... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Keybit
Posts: 12
Joined: Thu Nov 28, 2019 2:21 pm

Re: My script pastes the text “CONTENT={{!CLIPBOARD}}” rather than the actual clipboard contents?

Post by Keybit » Thu Nov 28, 2019 7:50 pm

Yes, that's has done the trick, thank you for your help. Most appreicated.
chivracq
Posts: 8871
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: My script pastes the text “CONTENT={{!CLIPBOARD}}” rather than the actual clipboard contents?

Post by chivracq » Thu Nov 28, 2019 7:55 pm

But hum..., as you using the 'Free' Version, I'm "afraid" you are going to hit one of the Limitations for the 'Free' Version(s), as you have 6 Blocks of 8 Lines for each C&P + a first Block with also 8 Lines => 48+8=54 but the Limit is at 50 Lines, ah-ah...! :P

(The 'Free' Version is "meant" for Home Users btw, "Business" Users are "expected" to take a 'PE' License (Personal Edition)... :wink: )

But I would have a "Solution" to shorten quite drastically your Script, by doing all 'EXTRACT''s on 'TAB_2' "together", and then all 'Paste''s on 'TAB_2' together... 8)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 8871
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: My script pastes the text “CONTENT={{!CLIPBOARD}}” rather than the actual clipboard contents?

Post by chivracq » Fri Nov 29, 2019 12:32 am

Alright, I've posted an Answer to your Qt in your parallel Thread on SOF, in some "simplified"/shortened Version, just to give directly the "Solution"...

And I gave you a '+1' for the Quality of your Qt on SOF, thing I do "rarely", and first time with the new "+10" Pts for Qt's... :)
And would be "nice" if you could accept my Accept, I very rarely post Answers on SOF as most Users on that Forum (for the 'iMacros' Tag) never bother to accept Answers, and 60-80% actually even delete their Qt/Thread as soon as they have their Answer/Solution/Working Script, which doesn't motivate much to answer Qt's on that Forum, ah-ah...! :roll:
And when I reply, I usually simply give the Sol in a Comment (to their Qt), I don't bother to go through all the Hassle of writing a "Quality" Answer as I know in most the Cases, the User will simply delete their Qt/Thread anyway... :roll:

And I don't really care about "Reputation" on that Site which I find completely "Fake" and feels like a "Strategic" Game, but I would like to reach the 500 Pts "one day" as I think I can review Queues from that Rep, and edit Qt's without fighting each time against all the stupid Validation Bugs that Site is full of, last one I mentioned in my Answer..., with all Formatting Icons that have disappeared, pfff, LOL, feels like an April's Fools Prank, ah-ah...! :|
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply