Search code examples
javascriptimacros

imacros extract text javascript


I need to get a text value from CSS element and then create a variable with that.

I could extract it with simple TAG with no JavaScript iimPlays, etc but I can't extract with my current code that need this:

I want to create a variable name:

iimSet('NAME', iimPlay(headerCode + 'TAG POS=1 SELECTOR="div.profile-info h1.member-name" BUTTON=0'));

Then I want to use the previously created variable from the extracted value:

iimSet('TITLE', title.replace(/FULLNAME/g, '{{NAME}}'));

Solution

  • Your description is unclear for me. So here's a more evident example of how to use the iimGetExtract() function:

    iimPlayCode("SET !EXTRACT ace");
    var name = iimGetExtract();
    
    iimSet("NAME", name);
    iimPlayCode('PROMPT "Hello, {{NAME}} !"');