iMacros help needed. Remove characters

TaAaZZ28

Regular Member
Joined
Aug 31, 2014
Messages
259
Reaction score
117
Hi! I am fairly new to iMacros. I am using iMacros to extract some text from title of the page then paste that text in a text box. Currently when I put that extracted text, it gets .mp4 written in it (title contains .mp4). I want to remove '.mp4' and replace it with '.com'
Currently I am doing this:


Code:
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:videoedit_title EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=1 TYPE=TEXTAREA FORM=NAME:NoFormName ATTR=ID:videoedit_description CONTENT="{{!VAR2}}.com"
wait seconds=2


This adds .com to the end but there is no code to remove .mp4


Any help would be appreciated. Thanks.
 
From the information that MrBlue provided, I suggest the line below gives you a point of reference for how to replace characters. You may need to make considerable adjustments to the code provided to match your exact needs and variable usage.

Code:
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"\.mp4\",\"\.com");")
 
From the information that MrBlue provided, I suggest the line below gives you a point of reference for how to replace characters. You may need to make considerable adjustments to the code provided to match your exact needs and variable usage.

Code:
Thanks, but your code has some error. Fixed it using the link Mr.Blue gave.
Fixed code if someone else needs it:

SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"\.mp4\",\"\.com");")

Thanks! But your code had some errors. Fixed it using the link MrBlue gave. Here is the fixed code if someone else needs it
Code:
SET newTitle EVAL("\"{{!VAR2}}\".replace(\".mp4\",\".com\");")
 
Or you could just save the results of the extraction into a file with iMacros and run a search and replace with a basic text editor.
There'll be one result per line.

Open your file in Notepad++
Hit Ctrl+H, it brings up the Replace window.
Search for: .mp4
Replace with: .com
Save the file.

And then you can use the new file as datasource in iMacros while playing your data entry macro in loop.

Nevertheless, if you already found the solution with iMacros, it's easier.
It's just an example, if you can't do something with one tool, another can help.
 
Back
Top