Extract current selected dropdown into variable

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
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
kingoftaurus
Posts: 5
Joined: Thu Sep 29, 2016 6:23 am

Extract current selected dropdown into variable

Post by kingoftaurus » Thu Sep 29, 2016 6:31 am

Hello iMacros pros!

I have a dropdown box with 75 items within it.

That dropdown box is currently selected on an item.

Here is the html:

Code: Select all

<select id="toolbar_uid" name="toolbar_uid" onchange="swapCharacter()" style="font-size:8pt;width:120px;">
                                                            <option value="267096" >SomethingHere</option>
                                                                <option value="267095" >SomethingThere</option>
                                                                <option value="267090" >TheresSomething</option>
                                                                <option value="74473" selected>Here'sSomething</option>
How can I extract the CURRENTLY SELECTED option value="77473" and store into a variable so that later in the iMacro I can do something like this:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:NoFormName ATTR=NAME:awardto CONTENT=%{{myVariable}}
iMacros 9.0.3
Windows 10
Firefox 49.0.1
chivracq
Posts: 9004
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract current selected dropdown into variable

Post by chivracq » Thu Sep 29, 2016 12:21 pm

kingoftaurus wrote:Hello iMacros pros!

I have a dropdown box with 75 items within it.

That dropdown box is currently selected on an item.

Here is the html:

Code: Select all

<select id="toolbar_uid" name="toolbar_uid" onchange="swapCharacter()" style="font-size:8pt;width:120px;">
                                                            <option value="267096" >SomethingHere</option>
                                                                <option value="267095" >SomethingThere</option>
                                                                <option value="267090" >TheresSomething</option>
                                                                <option value="74473" selected>Here'sSomething</option>
How can I extract the CURRENTLY SELECTED option value="77473" and store into a variable so that later in the iMacro I can do something like this:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:NoFormName ATTR=NAME:awardto CONTENT=%{{myVariable}}
CIM...! :mrgreen: (Always mention your FCI when you open a Thread, read my Sig, many Commands are not implemented for all Browsers/Versions...)

For your Qt, simply use 'EXTRACT', it's documented in the Wiki.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
kingoftaurus
Posts: 5
Joined: Thu Sep 29, 2016 6:23 am

Re: Extract current selected dropdown into variable

Post by kingoftaurus » Thu Sep 29, 2016 10:58 pm

iMacros for Firefox 9.0.3, Windows 10

Anyways, you say to "just use extract"

How do I use the extract to extract the currently selected item?
iMacros 9.0.3
Windows 10
Firefox 49.0.1
chivracq
Posts: 9004
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract current selected dropdown into variable

Post by chivracq » Thu Sep 29, 2016 11:15 pm

kingoftaurus wrote:

Code: Select all

iMacros for Firefox 9.0.3, Windows 10
Hum..., nearly good but FF Version still missing, FF48/49, I reckon...? :roll:

Anyways, you say to "just use extract"

How do I use the extract to extract the currently selected item?
=> ... Like you always use 'EXTRACT' "to extract the currently selected Item"...!
Did you find the Section in the Wiki explaining this exact Situation using nearly precisely your own Words...?
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
kingoftaurus
Posts: 5
Joined: Thu Sep 29, 2016 6:23 am

Re: Extract current selected dropdown into variable

Post by kingoftaurus » Fri Sep 30, 2016 2:24 am

http://wiki.imacros.net/!EXTRACT

Nothing there at all about extracting the currently selected option of a dropdown box. At all.

As far as the firefox version, I have no idea. (I Don't know why that is necessary anyway because I am not having a PROBLEM?BUG I just DON'T KNOW HOW to do something)
iMacros 9.0.3
Windows 10
Firefox 49.0.1
chivracq
Posts: 9004
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract current selected dropdown into variable

Post by chivracq » Fri Sep 30, 2016 11:03 am

kingoftaurus wrote:As far as the firefox version, I have no idea. (I Don't know why that is necessary anyway because I am not having a PROBLEM?BUG I just DON'T KNOW HOW to do something)
FCI with Versions for iMacros + Browser + OS is Required Info like mentioned in the Forum Rules, we are a Technical Forum, we like Technical Info...!, and I usually simply don't even read a Thread when (part of) that Info is missing, I was "nice to you" to react to your Thread because you were first time Poster to avoid your Thread to go rotting and you wondering why nobody answers it...
And many Commands are not implemented for all Browsers/Version or get broken from some specific Version, and FF is notorious on that point to regularly break Commands that were working fine in the previous Version.
But OK, never mind about your FF Version if it's too complicated, I don't think indeed it will play a role, FF48/49 is good enough.
But I won't react to your Thread next time you open a Thread if you don't mention your FCI.

And, hum..., if you don't know how to check your FF Version which is a very basic and standard Feature for all Software since 20 years (Help => About), I'm not sure you trying to use iMacros is a good idea, I'm afraid you are going to suffer a bit...! :shock:
kingoftaurus wrote:http://wiki.imacros.net/!EXTRACT

Nothing there at all about extracting the currently selected option of a dropdown box. At all.
Okay..., but you found the Wiki Page about '!EXTRACT' and not about 'EXTRACT' like I mentioned, try again... :roll:

The '!EXTRACT' Built-in Variable is the Result of and will contain the Data extracted by the 'EXTRACT' Command. You first need to use the 'EXTRACT' Command on your DDLB (Drop-Down-List-Box).

>>>

@TechSup, this '!EXTRACT' Wiki-Page could indeed contain a direct Link to the 'EXTRACT' Command in the 'See Also' Section. :idea:
Last edited by Tom, Tech Support on Fri Jan 27, 2017 1:19 pm, edited 1 time in total.
Reason: Done!
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
kingoftaurus
Posts: 5
Joined: Thu Sep 29, 2016 6:23 am

Re: Extract current selected dropdown into variable

Post by kingoftaurus » Fri Sep 30, 2016 5:31 pm

I found out how to look for the firefox version. The "help" and "about" part of it are actually hidden behind a third layer/

First I had to click "menu" which in MOST cases the "help" and "about" are listed there. I could not find it.

Then you have to click the "?" on the menu page

THEN About.

Normally the "about" menu is not hidden.

49.0.1


Now as for your "EXTRACT" without the "!" Here is the contents:

Code: Select all

EXTRACT
Jump to: navigation, search
EXTRACT command

    From Version 6.0 there is no separate EXTRACT command any more. Extractions are now handled by the TAG command by replacing the CONTENT=... parameter with the extract parameter EXTRACT=... .

    Please see the Extract section of the TAG command page for more information

!EXTRACT variable

    Besides the EXTRACT command, there is also the !EXTRACT variable.
In the "TAG" section, I still do not see an option for extracting the currently selected dropdown.

I see where I can select a specific item

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=%AP<SP>1 
But i'm not looking to make a selection, I am looking to grab the value of the currently selected item that can vary and store it into a variable to THEN select into a DIFFERENT dropdown box.
iMacros 9.0.3
Windows 10
Firefox 49.0.1
kingoftaurus
Posts: 5
Joined: Thu Sep 29, 2016 6:23 am

Re: Extract current selected dropdown into variable

Post by kingoftaurus » Sat Dec 17, 2016 8:50 am

Been a while. So bump.
iMacros 9.0.3
Windows 10
Firefox 49.0.1
chivracq
Posts: 9004
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract current selected dropdown into variable

Post by chivracq » Sat Dec 17, 2016 9:51 am

kingoftaurus wrote:I found out how to look for the firefox version. The "help" and "about" part of it are actually hidden behind a third layer/

First I had to click "menu" which in MOST cases the "help" and "about" are listed there. I could not find it.

Then you have to click the "?" on the menu page

THEN About.

Normally the "about" menu is not hidden.

49.0.1
Simply make the 'Menu Bar' visible in FF and you then still have the "conventional" 'File/Edit/View/.../Help' Menu with 'Help/About Firefox'...
This is "standard" use of a Browser...
kingoftaurus wrote:Now as for your "EXTRACT" without the "!" Here is the contents:

Code: Select all

EXTRACT
Jump to: navigation, search
EXTRACT command

    From Version 6.0 there is no separate EXTRACT command any more. Extractions are now handled by the TAG command by replacing the CONTENT=... parameter with the extract parameter EXTRACT=... .

    Please see the Extract section of the TAG command page for more information

!EXTRACT variable

    Besides the EXTRACT command, there is also the !EXTRACT variable.
In the "TAG" section, I still do not see an option for extracting the currently selected dropdown.

I see where I can select a specific item

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=%AP<SP>1 
But i'm not looking to make a selection, I am looking to grab the value of the currently selected item that can vary and store it into a variable to THEN select into a DIFFERENT dropdown box.
kingoftaurus wrote:Been a while. So bump.
Tja, sorry, but you didn't really read the Info that you quoted yourself:
Please see the Extract section of the TAG command page for more information
What you then quoted from the 'TAG' Page in the Wiki is not from the "Extract section"...:
TAG POS=1 TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=%AP<SP>1
You have a complete 'EXTRACT' Section on that Page that gives you the exact Answer to your Qt... :idea:

Sorry but I help Users who really get stuck with a Pb after they've done their best to find a Solution, I don't give "Trainings" on how to search the Wiki/Forum and I won't read the Documentation for you... :roll:
(And you don't need to wait another 2.5 months to follow up on your Thread if you still don't find it (but then you must be reading one line every 3 lines...!, euh...!?) or to hopefully post the Solution once you've found it to finish your Thread a bit neatly and useful as well for other Users... :idea: )
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply