auto fill in

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

TIMG

auto fill in

Post by TIMG » Mon Feb 17, 2003 8:03 pm

i have created a auto fill in macro for a web page and im having a problem with a drop down menu where the state goes does anyone know how to write a macro to select a state in a drop down menu. any help would greatly be apreciated ..thanks tim :lol:

Lumumba

Post by Lumumba » Mon Feb 17, 2003 9:29 pm

Tab to the dropdown list on the page. Field should appear as selected. Press the up/down button till the option you wanna choose will appear.


Example, the dropdownlist at this forum: Display posts from previous: 6 Months

//move to the field by pressing Tab several times
Press Tab*x
//preselect the field directly by sending a character
Send>6
//if the character can't be catched directly move to it by pressing up or down
Press Up
//Press Tab to move away from the field
Press Tab

TIMG

AUTO SUBMIT

Post by TIMG » Tue Feb 18, 2003 12:06 am

thanks for the help it works know i have a txt file that i want to get the press tab numeric value from .any sujestions please help tim...thnks :lol:

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 18, 2003 12:29 am

Use ReadLn to read from the text file. You may also need to do some string manipulation with MidStr and Position.
MJT Net Support
[email protected]

tim

auto submit

Post by tim » Tue Feb 18, 2003 12:56 am

[quote="support"]Use ReadLn to read from the text file. You may also need to do some string manipulation with MidStr and Position.[/quote
i tryed that and it dint work.
what i need to do is read the line then have the line = press tab *theline from the line in my text file so is this posible ?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 18, 2003 1:17 am

Hi,

Yes:

ReadLn>filename,linenum,theline
Press Tab * %theline%
MJT Net Support
[email protected]

timg

Post by timg » Wed Feb 19, 2003 12:24 am

support wrote:Hi,

Yes:

ReadLn>filename,linenum,theline
Press Tab * %theline%
the text box that i need to fill is a drop down that is the state
i have tryed the above method and it is not working . is the another way to read a line in a text file and then tell it to press down the aproerate numbe of times from the text file ?


i hjave tried
Readln>c:\credit.txt,22,theline
press dn *%theline%
and is isnot workin ...HELP PLEASE>>>>thanks Tim :D

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Feb 19, 2003 12:38 am

You need to TAB to the control and THEN press down:

Press Tab * x
Press Down * xx
MJT Net Support
[email protected]

timg

Post by timg » Wed Feb 19, 2003 12:45 am

support wrote:You need to TAB to the control and THEN press down:

Press Tab * x
Press Down * xx
yes i undestand that i need to use the tab to get to the feild...
what im trying to ask you is ...i have a text file that has a line in with the numeric value that equal a state for example CA would = 1
or FL would = 10
i would like to be able to read this value and sendit as the press down value. mabe i didnt explane myself clear enuff... i understan the readln function im useing it in the rest of my macro.so my question is how do i readln> then send>as the press down value ?thank you for your support .....tim :shock:

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Feb 19, 2003 12:52 am

Hi,

I don't really understand the format of your text file. Can you explain the format or email it to me? Then I might be able to help better.

Perhaps you can also give us a URL where we can test this out too - otherwise we're working blindfolded.
MJT Net Support
[email protected]

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Wed Feb 19, 2003 12:53 am

Hi Tim,

I'm not sure if we understand your query corecctly. Do you want to read in the 2-digit value from a text file and send the corresponding state name to the keyboard? That is, whenever readln> encounter 01, CA or California will be sent to the field. Is this your goal?

timg

Post by timg » Wed Feb 19, 2003 1:58 am

armsys wrote:Hi Tim,

I'm not sure if we understand your query corecctly. Do you want to read in the 2-digit value from a text file and send the corresponding state name to the keyboard? That is, whenever readln> encounter 01, CA or California will be sent to the field. Is this your goal?
YES for example alaska will alway be 01 and florida = 10
i want to use this numeric value as a presdown 10 times witch would result in that the state box would the equal florida. thanks for you help...Tim :shock: :shock:

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Feb 19, 2003 2:27 am

This is the easy bit.

The bit we haven't yet figured out is how we extract the numeric value which we then use to drop down the box.

We need to understand your file format and understand where in the file the numeric value appears, what logic is required to locate the correct line and where in the line it appears so that we can extract only the numeric portion.

e.g it could be:

Find the first line that equals "Florida"
then move on 3 lines to get the numeric code
extract that line
take the 2nd and 3rd chars to get the code ...

Or it might be something quite different. The point is we need to understand where everything appears in the file before we can know how to extract the required data from it.
MJT Net Support
[email protected]

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Wed Feb 19, 2003 2:40 am

I suppose your cursor is currently pointed to the first state, ie, Alabama, in a listbox just like booking a room with Travelodge, Super 8,..etc. I wrote the following script:


Readln>c:\temp\state.txt,1,Line
Sub>Line,1
If>Line=0,End
Press down *%line%
Labe>End


The above state.txt contains the following sample data:
01
05
08
39


Becuase Alabama is always the first state, you don't have to move your cursor. For the rest of states, just minus 1 to offset it. For Alaska, you just have to move cursor down only once.

Lumumba

Post by Lumumba » Wed Feb 19, 2003 7:22 am

Can't understand the issue.
A list of states will be static.
If you want to get the right state, use an ini file.

ReadLN>C:\MyLetter.txt,1,StateToGet
ReadIniFile>C:\States.ini,states,%StateToGet%,StepsToMake
Tab*%StepsToMake%
  • States.ini

    [states]
    alaska=1
    alabama=2
    arkansas=3
    california=4
    colorado=5
    ...
    Florida=10
    ...
It would be more difficult to choose from a dynamic drop down list. In this case I would check/read the HTML code in advance (ReadLN>) for the option field entries (and create/write the ini file on the fly).

You could have an additional check using WaitRectChanged> to be sure if the choosen state is the correct one.

If I've missed the point, ignore it ...

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts