how to identify text on a drop down list

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
roo
Newbie
Posts: 15
Joined: Thu May 29, 2008 12:12 am
Location: Washington D.C.

how to identify text on a drop down list

Post by roo » Sun Jun 08, 2008 9:48 pm

Can someone shed a clue on how I can identify something on a drop down list box like below:

Label>Run Add Printer
Run Program>control printers
WaitWindowOpen>Printers and Faxes
Press ALT
Send>f
Send>a
WaitWindowOpen>Add Printer Wizard
Send>n
Send>A

Wait>1
SetCheckBox>Add Printer Wizard,&Local printer attached to this computer,TRUE
Press Alt
Send>l
Release Alt
SetCheckBox>Add Printer Wizard,&Automatically detect and install my Plug and Play printer,FALSE
Press Alt
Send>n
Release Alt

Wait>1
SetCheckBox>Add Printer Wizard,&Create a new port:,FALSE
SetCheckBox>Add Printer Wizard,&Use theFollowing port:,TRUE
Press Alt
Send>u
Press Down

//not sure how to find IP in the list if it exsists

Release Alt
Label>exit

Thanks,
-roo

User avatar
Marcus Tettmar
Site Admin
Posts: 7381
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jun 09, 2008 7:01 am

Most drop down lists have a "drill down" feature where if you just send the text of the item you want it will get selected. As you type the list jumps to the nearest match. Try it manually - with the list box focused just try typing the first few chars of an item. It should get selected. So you can have Macro Scheduler select an item just by sending the text of the item.

Or you can try using GetListItem.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
roo
Newbie
Posts: 15
Joined: Thu May 29, 2008 12:12 am
Location: Washington D.C.

Post by roo » Mon Jun 09, 2008 2:48 pm

Thanks...
...but what if the item is not listed?

What I am trying to do is to see if there is an exsisting IP port listed and if not, create one in order to install a printer.

So what I need (in everyday language) is something like:
Find %IP Port Variable% on list
IF found SEND N to continue
ELSE
SEND C to create

Know what I mean?
I am still adapting to how one must think in order to translate what one does into MacroScheduler terms so it's a bit daunting.

Please let me know how you would handle this scenario so that I may learn.

Thanks,
-roo

User avatar
roo
Newbie
Posts: 15
Joined: Thu May 29, 2008 12:12 am
Location: Washington D.C.

Post by roo » Tue Jun 17, 2008 4:31 am

Update FYI:

If anyone can get the GetListItem to work in the Add a Printer window where you must choose between creating a new port or selecting one from a list, please let me know.

Otherwise; here is a way around it...

Have the script search the windows registry for the IP to use (which should be listed under H_Key_Local_Machine\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\) and delete it if it exsists thereby allowing you to continue the printer instalation by creating the port instead of checking the list to see if it is already created!

Hope this helps someone.

-roo

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