1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

iMacros help needed. Remove characters

Discussion in 'General Scripting Chat' started by TaAaZZ28, May 16, 2016.

  1. TaAaZZ28

    TaAaZZ28 Junior Member

    Joined:
    Aug 31, 2014
    Messages:
    176
    Likes Received:
    75
    Gender:
    Male
    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.
     
  2. MrBlue

    MrBlue Senior Member

    Joined:
    Dec 18, 2009
    Messages:
    974
    Likes Received:
    680
    Occupation:
    Web/Bot Developer
    This should get you started:
    Code:
    http://wiki.imacros.net/EVAL
     
    • Thanks Thanks x 2
  3. ChanzGrande

    ChanzGrande Elite Member

    Joined:
    Feb 16, 2008
    Messages:
    2,487
    Likes Received:
    1,179
    Occupation:
    Accountant
    Location:
    Northern Woods Counting Money
    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");")
    
     
    • Thanks Thanks x 1
  4. TaAaZZ28

    TaAaZZ28 Junior Member

    Joined:
    Aug 31, 2014
    Messages:
    176
    Likes Received:
    75
    Gender:
    Male
    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\");")
     
  5. HoNeYBiRD

    HoNeYBiRD Jr. VIP Jr. VIP

    Joined:
    May 1, 2009
    Messages:
    7,501
    Likes Received:
    8,427
    Gender:
    Male
    Occupation:
    Geographer, Tourism Manager
    Location:
    Ghosted
    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.