extract variable to js

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
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
wilmpie
Posts: 5
Joined: Mon Jun 22, 2009 8:22 pm

extract variable to js

Post by wilmpie » Thu Dec 31, 2015 9:24 am

hi

i'm trying to extract a text from js i use the iimplay function to play it but how can i get the extracted part into the javascript code? how can i get the extracted to a variable that js can work with .

second question : how can i get that extracted part back into a iimplay code ?

my extraction code :

Code: Select all

posting +=  "TAG POS=1 TYPE=BODY ATTR=TXT:* EXTRACT=TXT" + "\n";

thnx in advance
chivracq
Posts: 8535
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: extract variable to js

Post by chivracq » Thu Dec 31, 2015 11:04 am

wilmpie wrote:hi

i'm trying to extract a text from js i use the iimplay function to play it but how can i get the extracted part into the javascript code? how can i get the extracted to a variable that js can work with .

second question : how can i get that extracted part back into a iimplay code ?

my extraction code :

Code: Select all

posting +=  "TAG POS=1 TYPE=BODY ATTR=TXT:* EXTRACT=TXT" + "\n";
thnx in advance
CIM...! :mrgreen:

And your Question is a fairly basic one, a bit surprising for sbd who's been using iMacros since at least 2009, from your Registration Date on the Forum, and has been asked and answered many times already on the Forum (and is documented in the Wiki as well), so you'll find the Answer if you search the Forum a bit...

And hum, your last 2 Threads from 2009 and 2012 are still waiting for some Follow-up / a mini-Thanks from your Side, that doesn't work very "motiverend" to answer your Threads if you never follow up / answer Questions / thank the Users helping you... :idea:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
wilmpie
Posts: 5
Joined: Mon Jun 22, 2009 8:22 pm

Re: extract variable to js

Post by wilmpie » Thu Dec 31, 2015 11:44 am

if i found it in the wiki i did'nt ask it here :p

and i find the wiki bit hard to understand
the exemples are a diffrent way of coding i use to do (lot more extra stuff added to the code)

but well can anybody help me on thise part i looked in the forum and in the wiki butt i did'nt get it working or a good understanding answer
chivracq
Posts: 8535
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: extract variable to js

Post by chivracq » Thu Dec 31, 2015 1:09 pm

wilmpie wrote:if i found it in the wiki i did'nt ask it here :p

and i find the wiki bit hard to understand
the exemples are a diffrent way of coding i use to do (lot more extra stuff added to the code)

but well can anybody help me on thise part i looked in the forum and in the wiki butt i did'nt get it working or a good understanding answer
Woaw!, a Reply...!

"CIM" was a Question/Request, I normally don't answer Threads when Users don't mention their FCI, which is Required Info for opening a Thread, like stated in the Forum Rules, but never mind, it won't really make a difference in your case and I'm already positively surprised that you managed to follow up on this Current Thread... :D

Well, the Mechanism to communicate between '.iim' Macros and '.js' Scripts is to use '!EXTRACT' => 'iimGetExtract()' => 'iimSet()'.
And the Wiki Page for 'iimSet()' even contains a Link to a Forum Thread with Examples and more Info, even if the Example from TechSupport uses 'iimGetLastExtract()' which was deprecated a few years ago and replaced by 'iimGetExtract()', but both Commands still work.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
wilmpie
Posts: 5
Joined: Mon Jun 22, 2009 8:22 pm

Re: extract variable to js

Post by wilmpie » Thu Dec 31, 2015 1:57 pm

well i tryed the getlastextracted code already butt it returns empty no value send trho


i use thise

Code: Select all

var naam = iimGetExtract();
alert ("naam is  = "+naam)

thise alert returns empty
chivracq
Posts: 8535
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: extract variable to js

Post by chivracq » Thu Dec 31, 2015 5:09 pm

wilmpie wrote:well i tryed the getlastextracted code already butt it returns empty no value send trho

i use thise

Code: Select all

var naam = iimGetExtract();
alert ("naam is  = "+naam)
thise alert returns empty
Hahan..., if you had already tried it, that would speed up a bit the "process" if you mentioned proactively what you've already tried instead of saying more or less than you didn't find any Examples or whatever...

And, pfff..., I don't use '.js' Scripts at all myself, so I'm not a JavaScript Guru at all, all I know is from having a look at the ',js' Demo-Macros and from Threads on the Forum, but hum..., after searching the Forum a bit, I can't find one single Example of 'alert()' with Double Quotes like you do, only with Single Quotes or directly with a Variable in it without any Quotes or this Syntax:

Code: Select all

alert(iimGetLastExtract());
and always with a Semi-Colon at the end, so I wonder if your 'alert()' is completely empty of if you still get the "naam is = " part...?

Post your whole Script or a Script I can run myself, based on one of the Demo-Macros, it's too cumbersome to try to help you with meaningless mini-bits of Code, I can't see how you've declared and run your '.iim' Macro before calling the 'iimGetExtract()', if you've split your Macro into several parts for example, all Built-in Vars are reset between each 'iimPlay()'...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply