Multiple selection with considering previously selected item

Discussions and Tech Support related to the iMacros Google Chrome extension.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.
Post Reply
lesha_01
Posts: 3
Joined: Fri Jul 20, 2018 7:46 am

Multiple selection with considering previously selected item

Post by lesha_01 » Fri Jul 20, 2018 8:03 am

Hello.
I have IMacros for Chrome VERSION BUILD=1001, Chrome 67.0.3396.99.
I always use standart code for multiple selection menu:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=#1:#3:#8 
It works fine. But If in menu previously were selected other items (#4 and #5, for example) they are not saved after running this code.
On keyboard I can hold CTRL button to add new items in multiple menu (with saving previously selected items), and how I do this in IMacros?
chivracq
Posts: 7877
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple selection with considering previously selected

Post by chivracq » Fri Jul 20, 2018 12:06 pm

lesha_01 wrote:Hello.
I have

Code: Select all

IMacros for Chrome VERSION BUILD=1001, 
Chrome 67.0.3396.99.
I always use standart code for multiple selection menu:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=#1:#3:#8 
It works fine. But If in menu previously were selected other items (#4 and #5, for example) they are not saved after running this code.
On keyboard I can hold CTRL button to add new items in multiple menu (with saving previously selected items), and how I do this in IMacros?
Your Thread has probably nothing specific to the 'iMacros for CR' Sub-Forum btw..., unless you can mention that you've tested in some other Browser, "correct" Sub-Forum would have been the 'General' one... (for next time, no need to duplicate now...)

Hum..., are you sure you are using v10.0.1 for CR...? (Some v10.0.2 for CR Update was released a few weeks ago...)
And for v10.x, you need to mention as well if you are using the 'Free' or 'PE' (Personal Edition)...
+ OS is missing from your FCI...
['Free'/'PE' + 'OS' shouldn't play a "Role" in this Thread I think, but I usually don't answer Threads if FCI (and the 'F' stands for "Full", read my Sig...) is not mentioned or not complete... :idea: )

>>>

OK, hum, interesting Qt... :D , but I'm not surprised by the "Behaviour" you describe... :|
You probably need to first "save stg" about your first Selection with Items '#4' & '#5' (but it depends a bit on how the Page works I guess), before letting your Script do the Selection '#1:#3:#8'...
You would get the same Behaviour I think if you started typing manually stg in some 'IMPUT' Field, without saving/submitting, and then letting some iMacros Script fill in that same 'INPUT' Field..., the "manual" Content will be replaced by the Content from your Script... (at least with the 'TAG' Mode..., it can be avoided with the 'EVENT' Mode...).

If your '#4:#5' Selection is done manually, then you can "do it" the other way around..., first let iMacros do the Selection for '#1:#3:#8', add a 'PAUSE' to your Script, and only then do the extra manual Selection with '#4:#5'.

If you "really" want to do everything from your Script, you could first try extracting (with 'EXTRACT=TXT') which Item(s) is/are already selected, and using 'EVAL()' to "reconstruct" the Full Selection...
But I'm not sure the 'EXTRACT' will work with multiple already selected Items, I think it only extracts the visible Item in the DDLB... (I've never tried...)
And reconstructing the Full Selection will be a bit "tricky" because the '#' Selector (= 'Select by Index' Selector) must be outside the Var(s), so you might hit some Limitations if your Nb of Items to select might be variable (sometimes 5, up to say 8, for example), then you might need to "hard-code" always selecting 8 Items, but if you only need 5 out of 8, I'm not sure how iMacros will "behave" with the last 3 "unnecessary" Items, if you repeat some Items or fake-try to select some fake '#99' Item...

I've never needed that "Functionality" for myself, so I've never tried..., and you are the first to ask on the Forum...
Provide the URL to your Site/Page, or to some "Public" Site containing such a Multiple Selection DDLB and I can have a Look..., and try as well a few other "Things" and "Tricks" that I didn't mention... :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...
lesha_01
Posts: 3
Joined: Fri Jul 20, 2018 7:46 am

Re: Multiple selection with considering previously selected

Post by lesha_01 » Fri Jul 20, 2018 12:37 pm

Thank you for the answer! Page is not in public access, so I can show only code of multiple selection form with preselected items (4 and 5):

Code: Select all

<select name="colorbody_multilov[]" multiple="multiple" size="10">
	<option value="beige">1</option>
	<option value="white">2</option>
	<option value="turquoise">3</option>
	<option value="bordo" selected="">4</option>
	<option value="bronze" selected="">5</option>
	<option value="lblue">6</option>
	<option value="yellow">7</option>
	<option value="green">8</option>
	<option value="golden">9</option>
</select>
chivracq
Posts: 7877
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple selection with considering previously selected

Post by chivracq » Fri Jul 20, 2018 1:47 pm

lesha_01 wrote:Thank you for the answer! Page is not in public access, so I can show only code of multiple selection form with preselected items (4 and 5):

Code: Select all

<select name="colorbody_multilov[]" multiple="multiple" size="10">
	<option value="beige">1</option>
	<option value="white">2</option>
	<option value="turquoise">3</option>
	<option value="bordo" selected="">4</option>
	<option value="bronze" selected="">5</option>
	<option value="lblue">6</option>
	<option value="yellow">7</option>
	<option value="green">8</option>
	<option value="golden">9</option>
</select>
Okay..., well, then you can try all the Suggs I mentioned, and if you need to go along the "extract previously selected Items and reconstruct the full Selection" way, if the 'EXTRACT=TXT' doesn't work to retrieve the 2x '#4:#5' Items already selected, those 2 are clearly visible in your Source and could be easily extracted from an 'EXTRACT=HTM' on the same DDLB + 'EVAL()' to isolate those 2 thanks to their 'selected' Attribute that the other Items do not have... 8)
- (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...
lesha_01
Posts: 3
Joined: Fri Jul 20, 2018 7:46 am

Re: Multiple selection with considering previously selected

Post by lesha_01 » Fri Jul 20, 2018 1:52 pm

Thank you! I'll try to extract selected items and select them again :D
chivracq
Posts: 7877
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple selection with considering previously selected

Post by chivracq » Fri Jul 20, 2018 1:55 pm

lesha_01 wrote:Thank you! I'll try to extract selected items and select them again :D
Yeah, good luck..., and post your Final Script..., or if you get stuck..., though it will hard to help you "precisely" any further if I can't "play" with the Page myself... 8)
- (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