WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Control Manager
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Using cSetLVItem to Select a Drop-Downl Listbox Item

Keywords: 	  cSetLVItem

Question:

I'm trying to select an item in a drop-down listbox in IE using cSetLVItem. Specifically, I want to try to specify a different folder for the Internet Explorer temporary cache files. In my case, I'm trying C:\Windows\Temp. How can I select that folder?

To get to this window, first start up IE4. Then click on View Internet Options. Then click on Settings. Then click on Move Folder. Then click on Yes.

Now I want to run the following bit of code to change the directory: In Win95, it simply doesn't want to select that folder. Any ideas??

Answer:

Here's some working code. Because of a weirdness in IE, where the parent window has to reply back to the Double-click request, we need to break up the statements for the different directories, and allow time delays in between.

Also note that listbox names are case sensitive, and that there must be a space before the directory letter.

NB from the developers: You may have problems selecting drives in Explorer. The treeview control's item list is constructed, in part, on the fly. The shell will not build the folder hierarchy for a drive until the drive letter has been expanded. We can not expand it for the user because it could be to an empty removable drive which will cause an error.

This works great for me:


;  Add the control manager extender.
AddExtender("wwctl34I.dll")
;debug (@oN)

; Find the Explorer tree control
hwnd      = DLLhwnd("Browse for Folder")
hwnd      = cwndbyclass(hwnd,"SysTreeView32")


; The following Directory selections are CaSe-SeNsItIvE!! ...
selection1 = "Desktop%@TAB%My Computer%@TAB% (C:)"
selection2 = "Desktop%@TAB%My Computer%@TAB% (C:)%@TAB%WINDOWS"
selection3 = "Desktop%@TAB%My Computer%@TAB% (C:)%@TAB%WINDOWS%@TAB%TEMP"


; and again... Select the item from the tree control.
if ! csettvitem(hwnd, selection1)
   message("Item not selected",  "Node tree:%@CRLF% %selection1% %@CRLF%-not found.")
   exit
endif
if !cdblclickitem(hwnd, "")
  Message ("cdDblClickItem", "Failed 1")
  exit
endif
TimeDelay(2)

if !csettvitem(hwnd, selection2)
   message("Item not selected",  "Node tree:%@CRLF% %selection2% %@CRLF%-not found.")
   exit
endif
if !cdblclickitem(hwnd, "")
  Message ("cdDblClickItem", "Failed 2")
  exit
endif

TimeDelay(2)

if csettvitem(hwnd, selection3)


; Double click the selected item.
if !cdblclickitem(hwnd, "")
  Message ("cdDblClickItem", "Failed")
endif
else
; Can't select the item
selection = strreplace(selection3,@TAB, @CRLF)
message("Item not selected",  "Node tree:%@CRLF% %selection3% %@CRLF%-not found.")
endif

Article ID:   W12500
Filename:   cSetTVItem and Selecting Subdirs in Dropdown Listboxes.txt
File Created: 2001:12:12:17:09:34
Last Updated: 2001:12:12:17:09:34