Jump to content
UBot Underground

Adding a list into the UI dropdown


Recommended Posts

Hi all,

 

Im grabbing a list from Linkedin (the list is the Locations of all my contacts inside Linkedin: http://screencast.com/t/vPR7uMbtc

 

This list can be foudn here by logging into your LI account: http://www.linkedin.com/people/connections

 

Now, the problem I have is not the list itself but when I load it into the UI dropdown.

 

Here's a sample of the list:

 

Dallas/Fort Worth Area (51),
Greater Denver Area (49),
Washington D.C. Metro Area (49),
Sydney Area, Australia (47),
Greater Boston Area (44),
Toronto, Canada Area (44),
Miami/Fort Lauderdale Area (33),
Tampa/St. Petersburg, Florida Area (33),
Philippines (31),
Orange County, California Area (30),
Mumbai Area, India (28),
Pune Area, India (27),
Bengaluru Area, India (26),
New Delhi Area, India (26),
Phoenix, Arizona Area (26),
United Arab Emirates (26),

 

 

The comma added to the end of the last bracket ), is there so that when it is loaded into the UI dropdown it will recognise the comma as the next option in the dropdown.

 

However, the problem I am having are with locations where there is a comma in their name - for example Sydney Area, Australia (47), which ultimately adds "Sydney Area" to a line on its own when in fact it belongs to Sydney Area, Australia

 

How do I get this loaded into the UI dropdown correctly?

 

Thanks in advance!

 

Kevin

Link to post
Share on other sites

Thanks TJ,

 

It's still causing me the problem by splitting (for example London, United Kingdom into London (new line) United Kingdom. I'll share the code here, just add your login details and see it. I currently save the information to d:\linkedinlocations.txt

 

clear cookies
clear list(%fixedlocations)
clear list(%locations)
navigate("http://www.linkedin.com/people/connections""Wait")
type text(<email field>"EMAIL""Standard")
type text(<password field>"PASSWORD""Standard")
click(<login button>"Left Click""No")
wait for browser event("Page Loaded""")
wait for element(<innertext="Locations">"""Appear")
click(<innertext="Locations">"Left Click""No")
wait for element(<datakey="ie">"""Appear")
add list to list(%locations$scrape attribute(<outerhtml=w"<li datakey=\"*\"><span>*</span> (*)</li>">, "innertext"), "Delete", "Global")
remove from list(%locations, 0)
set list position(%locations, 0)
loop($list total(%locations)) {
    add item to list(%fixedlocations, $replace($next list item(%locations), ")", ")"), "Delete", "Global")
}
save to file("d:\\linkedinlocations.txt", %fixedlocations)
ui drop down("test", $replace($read file("D:\\linkedinlocations.txt"), $new line, ","), #test)

 

 

 

This code will log you in, navigate to your connections and grab the cities where they are all from and then save that to d:\ as a text file.

Link to post
Share on other sites
wait(1)
set(#list, $list from file("d:\\linkedinlocations.txt"), "Global")
wait(1)
set(#list2, $replace(#list, ",", $nothing), "Global")
wait(1)
set(#list3, $replace(#list2, ")", "),"), "Global")
save to file("d:\\linkedinlocations2.txt", #list3)
ui drop down("test", $list from file("d:\\linkedinlocations2.txt"), #area)

 

try this

 

delete last line of your code and add snippet above

 

you can condense replace code into 1 line I just made it 2 to show both steps clearly.

 

  • First replace removes all commas 
  • second replace readds commas after bracket

saves converted list and then loads it in ui

Link to post
Share on other sites

I think I have the answer to this.

loop thru the list

each loop set the item being worked replace all commas with space

This leaves you with a space after the last parentice

replace ") " with ")," I do this a lot. ubot will regonize the space created b

y the space bar as a valid carachtor

Link to post
Share on other sites

That's great nuc63

 

Only problem now though is that the variable #area has a blank line above it for a majority of the locations e.g. London United Kingdom (78) http://screencast.com/t/UbQbTAee5

 

How can I delete this blank line?

 

Are you just getting a line at the begginning and end or throughout the ui?

 

if certain cites have blanks above them post a new list for me to look at " London United Kingdom (78)" is not in your list above.

 

to get rid of end change your code to below. if there is one at begining you need to save file and close ubot file reopen and it should be gone.

 

Last list3 adds LLLLLL to end of script after last comma

list4 removes ,LLLLLL

 

 

wait(1)
set(#list, $list from file("C:\\Users\\Ken\\Desktop\\temp file\\list.txt"), "Global")
wait(1)
set(#list2, $replace(#list, ",", $nothing), "Global")
wait(1)
set(#list3, "{$replace(#list2, ")", "),")}LLLLLL", "Global")
wait(1)
set(#list4, $replace(#list3, ",LLLLLL", $nothing), "Global")
wait(1)
save to file("C:\\Users\\Ken\\Desktop\\temp file\\list2.txt", #list4)
ui drop down("test", $list from file("C:\\Users\\Ken\\Desktop\\temp file\\list2.txt"), #area)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...