I have Imacro code, where code first fills the field with some text. I want after fill up the form, it searches each of the already filled form to check some text and if it founds this text in any field, replaces the text string
Any sugesstion how to do this
First I want to iterate through all the field and check for the string "strong" (in POS 3) and save POS=3
Next delete the string "strong " from POS=3
Please share any idea how to do that
Try this macro:
SET textOut "strong"
SET textIn ""
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=TEXTAREA FORM=ID:post ATTR=NAME:answer[] EXTRACT=TXT
TAG POS=2 TYPE=TEXTAREA FORM=ID:post ATTR=NAME:answer[] EXTRACT=TXT
TAG POS=3 TYPE=TEXTAREA FORM=ID:post ATTR=NAME:answer[] EXTRACT=TXT
TAG POS=4 TYPE=TEXTAREA FORM=ID:post ATTR=NAME:answer[] EXTRACT=TXT
SET posNum EVAL("var a = '{{!EXTRACT}}'.split('[EXTRACT]'); for (i in a) if (a[i].match(/{{textOut}}/)) break; ++i;")
SET !EXTRACT NULL
TAG POS={{posNum}} TYPE=TEXTAREA FORM=ID:post ATTR=NAME:answer[] EXTRACT=TXT
SET newText EVAL("'{{!EXTRACT}}'.replace(/{{textOut}}/g, '{{textIn}}').trim();")
TAG POS={{posNum}} TYPE=TEXTAREA FORM=ID:post ATTR=NAME:answer[] CONTENT={{newText}}
Old info.
Here is a code to replace some text in the first textarea:
SET textOut "abc"
SET textIn "def"
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=TEXTAREA FORM=ID:post ATTR=NAME:answer[] EXTRACT=TXT
SET newText EVAL("'{{!EXTRACT}}'.replace(/{{textOut}}/g, '{{textIn}}');")
TAG POS=1 TYPE=TEXTAREA FORM=ID:post ATTR=NAME:answer[] CONTENT={{newText}}
SET !EXTRACT NULL
For other fields just change the number of the POS parameter.
In order to define the position number, you may adjust the following block:
SET curPos 1
TAG POS={{curPos}} TYPE=TEXTAREA FORM=ID:post ATTR=NAME:answer[] EXTRACT=TXT
SET posNum EVAL("('{{!EXTRACT}}'.match(/{{textOut}}/)) ? {{curPos}} : 'NULL';")
PROMPT {{posNum}}
Related
VERSION BUILD=1005 RECORDER=CR
SET !ERRORIGNORE YES
URL GOTO=https://api.whatsapp.com/send?phone=923002021392&text=Great%20Offer%20For%20Karachites!%20Get%20a%20Free%20Squishy%20StressBall%20By%20Just%20Paying%20Rs%20200%20Delivery.%20Get%20your%20free%20Ball%20at:%20http://netlify.com/%20Have%20fun.
TAG POS=1 TYPE=A ATTR=TXT:Send
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=DATA-ICON:send&&CLASS:
URL GOTO=https://api.whatsapp.com/send?phone=923002021397&text=Great%20Offer%20For%20Karachites!%20Get%20a%20Free%20Squishy%20StressBall%20By%20Just%20Paying%20Rs%20200%20Delivery.%20Get%20your%20free%20Ball%20at:%20http://netlify.com/%20Have%20fun.
TAG POS=1 TYPE=A ATTR=TXT:Send
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=DATA-ICON:send&&CLASS:
URL GOTO=https://api.whatsapp.com/send?phone=923002025509&text=Great%20Offer%20For%20Karachites!%20Get%20a%20Free%20Squishy%20StressBall%20By%20Just%20Paying%20Rs%20200%20Delivery.%20Get%20your%20free%20Ball%20at:%20http://netlify.com/%20Have%20fun.
TAG POS=1 TYPE=A ATTR=TXT:Send
WAIT SECONDS=10
I have a list of 1000 Numbers, and I can't add more than 50 lines, how can I use an Array or Loop?
As you see that link has different phone numbers, I want those number to be taken from Array or txt files.
You can try the following code:
SET !VAR1 EVAL("[923002021392, 923002021397, 923002025509][{{!LOOP}} - 1];")
URL GOTO=https://api.whatsapp.com/send?phone={{!VAR1}}&text=Great%20Offer%20For%20Karachites!%20Get%20a%20Free%20Squishy%20StressBall%20By%20Just%20Paying%20Rs%20200%20Delivery.%20Get%20your%20free%20Ball%20at:%20http://netlify.com/%20Have%20fun.
TAG POS=1 TYPE=A ATTR=TXT:Send
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=DATA-ICON:send&&CLASS:
Play this macro repeatedly (in loop mode).Hope it helps.
I want to extract data from an input Text through iMacros. Here is my code:
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:timeentry_total CONTENT=60
I tried using:
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:timeentry_total EXTRACT:TXT
This gives me 'wrong format' error.
What should I do?
Thanks
Fahad
Please change the format to
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:timeentry_total EXTRACT=TXT
Instead of
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:timeentry_total EXTRACT:TXT
As you can see, the only difference is that you are using : instead of = which is causing the issue!
I am unable to find any function or any things in imacro where i can define last number in loop i.e. up to when loop has to run, I have started loop from row number 2 and want to end loop on 1500 row, so how i can give this (1500) value in imacro instead of manual filling, sugget the best way if anyone have the same, coding is:
TAB T=1
SET !TIMEOUT_PAGE 999
SET !ERRORIGNORE YES
SET !DATASOURCE XXXXXX.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=NAME:search[order_nr] CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:NoFormName ATTR=*
TAG POS=1 TYPE=TD ATTR=TXT:{{!COL1}}
TAG POS=1 TYPE=SELECT FORM=ID:refund_form ATTR=ID:refund_method CONTENT=XXXxX
TAG POS=1 TYPE=TEXTAREA FORM=ID:refund_form ATTR=ID:remarks CONTENT=Done
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:refund_form ATTR=ID:submit
If you don't want to apply the Scripting Interface, try the following workaround:
TAB T=1
SET !TIMEOUT_PAGE 999
SET !ERRORIGNORE YES
SET !DATASOURCE XXXXXX.csv
SET startLoop 2
SET maxLoop 1500
SET !LOOP EVAL(1-{{maxLoop}}+{{startLoop}})
SET normLoop EVAL({{!LOOP}}+{{maxLoop}}-1)
SET !DATASOURCE_LINE {{normLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=NAME:search[order_nr] CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:NoFormName ATTR=*
TAG POS=1 TYPE=TD ATTR=TXT:{{!COL1}}
TAG POS=1 TYPE=SELECT FORM=ID:refund_form ATTR=ID:refund_method CONTENT=XXXxX
TAG POS=1 TYPE=TEXTAREA FORM=ID:refund_form ATTR=ID:remarks CONTENT=Done
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:refund_form ATTR=ID:submit
Pay attention to the fact that you have to play this macro in usual (not loop) mode.
I have a script that will run the same exact process (pasting a list from a CSV into a text box), many times on the same web page, and I'm trying to get it to run the process one time for many CSV's in the working folder (1.csv, 2.csv, 3.csv,... 100.csv, etc).
Is it possible for iMacros to loop through the same script, only varying the input file (!DATASOURCE)?
I will name the CSV's numerically so the script can cycle through them easily.
Link to sample CSV (note: all keywords put into 1 cell so that it can be pasted as a list, one per line).
Example of how each CSV file's contents will be pasted as a list (one keyword per line):
I am new to iMacros and was hoping this would work, but it stops running on the 2nd loop, and throws the error:
TypeError: this.dataSource[(line - 1)] is undefined, line 14 (Error code: -1001)
Here is the code I have so far:
VERSION BUILD=8961227 RECORDER=FX
TAB T=1
SET !DATASOURCE {{!LOOP}}.csv
URL GOTO=https://sellercentral.amazon.com/hz/cm/adgroup/create?campaignId=A0478490D2AQYA9C8NTW
TAG POS=1 TYPE=DIV ATTR=ID:product-search-results
TAG POS=1 TYPE=INPUT:SEARCH FORM=ID:form-ad-group ATTR=ID:product-search-input CONTENT=product<SP>name
TAG POS=1 TYPE=BUTTON FORM=ID:form-ad-group ATTR=ID:product-search-button
TAG POS=1 TYPE=BUTTON FORM=ID:form-ad-group ATTR=TXT:Select
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-ad-group ATTR=ID:txt-starting-bid CONTENT=1.25
TAG POS=1 TYPE=A ATTR=ID:tool-kw-ui-manual
TAG POS=1 TYPE=TEXTAREA FORM=ID:form-ad-group ATTR=ID:txt-keywords CONTENT={{!COL1}}
TAG POS=1 TYPE=DIV ATTR=TXT:Add<SP>these<SP>keywordsSaving...
Note:
I'm trying to automate data entry of a list, and since the data needed to be pasted one keyword per line, I had to save my list with notepad as a .csv and put quotation marks before the first keyword, and after the last keyword, so iMacros would recognize it as just 1 cell.
Just realized my approach was valid, just didn't realize I had to put the SET !DATASOURCE_LINE 1 after SET !DATASOURCE {{!LOOP}}.csv
The working code I have now looks like this:
VERSION BUILD=8961227 RECORDER=FX
TAB T=1
SET !DATASOURCE {{!LOOP}}.csv
SET !DATASOURCE_LINE 1
URL GOTO=https://sellercentral.amazon.com/hz/cm/adgroup/create?campaignId=A0478490D2AQYA9C8NTW
TAG POS=1 TYPE=DIV ATTR=ID:product-search-results
TAG POS=1 TYPE=INPUT:SEARCH FORM=ID:form-ad-group ATTR=ID:product-search-input CONTENT=product<SP>name
TAG POS=1 TYPE=BUTTON FORM=ID:form-ad-group ATTR=ID:product-search-button
TAG POS=1 TYPE=BUTTON FORM=ID:form-ad-group ATTR=TXT:Select
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-ad-group ATTR=ID:txt-starting-bid CONTENT=1.25
TAG POS=1 TYPE=A ATTR=ID:tool-kw-ui-manual
TAG POS=1 TYPE=TEXTAREA FORM=ID:form-ad-group ATTR=ID:txt-keywords CONTENT={{!COL1}}
TAG POS=1 TYPE=DIV ATTR=TXT:Add<SP>these<SP>keywordsSaving...
Normally when selecting an option from dropdown menu, the recorded macro look somewhat like this
TAG POS=1 TYPE=SELECT FORM=NAME:prod ATTR=NAME:variantID_4 CONTENT=%234
But a website gives me this code for dropdown menu
TAG POS=1 TYPE=LI FORM=ID:enterNewOfferForm ATTR=ID:conditionSelect_chzn_o_3
There is no CONTENT tag. As a result when I play the macro, it does not select anything from the dropdown menu.
Here is the full code
VERSION BUILD=10022823
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=website/enterNewOffer.php
TAG POS=1 TYPE=TEXTAREA:TEXT FORM=ID:enterNewOfferForm ATTR=NAME:artex2Input CONTENT=Description
TAG POS=4 TYPE=INPUT:TEXT FORM=ID:enterNewOfferForm ATTR=*
TAG POS=1 TYPE=LI FORM=ID:enterNewOfferForm ATTR=ID:conditionSelect_chzn_o_3
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:enterNewOfferForm ATTR=NAME:taxInput CONTENT=2<SP>dollar
I tried many variations of the code but no success
Please pay the attention that you need to get a value of select tag, not of some li item.
It means that you need to use TYPE=SELECT (not TYPE=LI).
TAG POS=1 TYPE=SELECT FORM=ID:enterNewOfferForm ATTR=ID:conditionSelect_chzn_o_3
in the case if for some reason you really need to get a value of all options (li), you can extract them for future processing:
VERSION BUILD=1005 RECORDER=CR
SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL
TAG POS=1 TYPE=SELECT FORM=ID:enterNewOfferForm ATTR=ID:conditionSelect_chzn_o_3 EXTRACT=TXTALL
PROMPT {{!EXTRACT}}