Mitchf

Reading information out of a drop down box

2 posts in this topic

Hi all! As you can all see i am very new to Autoit  (I am very sorry if i am asking this in the wrong place or if this has been answered somewhere else). 

What I am doing is copying a set of information from one window into another one. I have a working script that copies all of the text information over, but there is one field where i need to copy the information that is included in a drop down menu (copy and paste of text does not work).

Here is my script copying the text: 

#include <AutoItConstants.au3>


HotKeySet("{ESC}","terminate")

Func terminate()
    Exit
 EndFunc


;maximise window of C4u 1 and tab to code, copy code with ctrl c
WinActivate("C4u - V5.1.0.0 (P01) - Internet Explorer")
MouseClick($MOUSE_CLICK_left, 58, 399, 1, 10)
MouseClick($MOUSE_CLICK_left, 170, 401, 1, 10)
Send("{TAB}")
Send("+{TAB 26}")
Send("^c")

;Tab to other c4u
WinActivate("C4u - V5.1.0.0 (P01) - Google Chrome")

;new element open, with TAB to time element field and paste with ctrl v
MouseClick($MOUSE_CLICK_left, -1860, -483, 1, 10)
MouseClick($MOUSE_CLICK_left, -1877, -461, 1, 10)
Sleep(2000)
Send("{TAB 9}")
Send("^v")
MouseClick($MOUSE_CLICK_left, -1827, -130, 5, 10)
WinActivate("C4u - V5.1.0.0 (P01) - Internet Explorer")

;copy description from other C4u and paste into new element
Send("{TAB 2}")
Send("^a")
Send("^c")
WinActivate("C4u - V5.1.0.0 (P01) - Google Chrome")
Send("+{TAB 16}")
Send("^a")
Send("^v")

;Tab to first description and copy and paste into second c4u
WinActivate("C4u - V5.1.0.0 (P01) - Internet Explorer")
Send("{TAB 24}")
Send("^a")
Send("^c")
WinActivate("C4u - V5.1.0.0 (P01) - Google Chrome")
Send("{TAB 24}")
Send("^a")
Send("^v")

;Second and further parts (first line finished)
$first = 0
WinActivate("C4u - V5.1.0.0 (P01) - Internet Explorer")
Send("{TAB}")
Send("^a")
Send("^c")
WinActivate("C4u - V5.1.0.0 (P01) - Google Chrome")
Send("{TAB}")
Send("^a")
Send("^v")

WinActivate("C4u - V5.1.0.0 (P01) - Internet Explorer")
Send("{TAB}")
Send("^a")
Send("^c")
Send("{TAB}")
WinActivate("C4u - V5.1.0.0 (P01) - Google Chrome")
Send("{TAB}")
Send("^a")
Send("^v")
Send("{TAB}")
send("{down 9}")
$first += 1

;Further cells with Loop set to limit (per full line)
Do
WinActivate("C4u - V5.1.0.0 (P01) - Internet Explorer")
Send("{TAB}")
Send("^a")
Send("^c")
WinActivate("C4u - V5.1.0.0 (P01) - Google Chrome")
Send("{TAB}")
Send("^a")
Send("^v")

WinActivate("C4u - V5.1.0.0 (P01) - Internet Explorer")
Send("{TAB}")
Send("^a")
Send("^c")
WinActivate("C4u - V5.1.0.0 (P01) - Google Chrome")
Send("{TAB}")
Send("^a")
Send("^v")

WinActivate("C4u - V5.1.0.0 (P01) - Internet Explorer")
Send("{TAB}")
Send("^a")
Send("^c")
Send("{TAB}")
WinActivate("C4u - V5.1.0.0 (P01) - Google Chrome")
Send("{TAB}")
Send("^a")
Send("^v")
Send("{TAB}")
send("{down 9}")
$first += 1
Until $first = 6

Sleep(40000)

The part with the down 9 is where the dropdown menu is.

 

Again sorry if my code sucks, only started with this about 3 or 4 days ago. Any tips are appreciated! 

Share this post


Link to post
Share on other sites



Hi Mitchf,

 

Welcome to the forums!

Dropdown menus on a webpage are notoriously difficult to automate and the fact that you gave no particular website is probably why no one answered yet.

No need to be ashamed of your code, most of us started using Autoit like this.

Problem with doing it this way is that it is very unreliable and prone to mistakes.

There a several ways that you can go at this; IE UDF (Internet Explorer - User Defined Functions) has some cool functions but the quickest easiest way I know to get text from a website is

InetGet  & InetRead

this function will provide you with all the source code from the website, including (I have to assume since I never tried it) dropdown menu entries.

You will then need to use the:

File, Directory and Disk functions

To parse the text and get what you need.

Search the Helpfile , WIKI and forums for info & examples and give it a shot and come back if you get stuck.

Good luck!

Bill

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now