Jump to content
kcvinu

ControlTreeView is not working properly

Recommended Posts

kcvinu

Hi all,

I am experimenting with ControlTreeView function. But when i try this code, it is not doing anything.

ControlTreeView("PhraseExpress Freeware v10.5.41f","",132066,"Select","PhraseExpress|Ahat|#3")

Please see this image. I have use "WinActivate" function before this code. But no way.

 000041.jpg


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
BrewManNH

What's not working? Where's the code that shows it not working, I see one line of code with absolutely no explanation? What is 132066? Is that a control ID, a control handle, what does it represent on the GUI?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
kcvinu

I have write code for activating Phrase express window and then selecting an item from this treeview(see image.) So i am expecting the result as a selection. But nothing is selected after the execution.  And 132066 is the control id of this treeview.

 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
Starstar

Put the control id in quotes......."[ID:132066]"

Edited by Starstar
Editing after Melba23 suggestions

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post


Link to post
Share on other sites
Melba23

Starstar,

If you are going to make suggestions, at least make them sensible - since when have ControlIDs of any sort been strings?

From the Help file:

ID - The internal control ID. The Control ID is the internal numeric identifier that windows gives to each control

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Starstar

Starstar,

If you are going to make suggestions, at least make them sensible - since when have ControlIDs of any sort been strings?

From the Help file:

ID - The internal control ID. The Control ID is the internal numeric identifier that windows gives to each control

M23

​O>K....Now is it fine......????


Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post


Link to post
Share on other sites
Melba23

Starstar,

Much better - although you might as well use the numeric value directly.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Starstar

Starstar,

Much better - although you might as well use the numeric value directly.

M23

​Thanks...


Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post


Link to post
Share on other sites
kcvinu

@Melba does the ControlID change automatically after a system restart ?. I have experienced so. Last day control ID was 132066. But today the ID is 197582. 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
BrewManNH

Use ControlGetHandle to get the handle to the control you need, handles change every time you run the script as a general rule. You don't have to use the numeric control ID of the control in the function, there are other ways of determining which control you want to get the handle from.

  • Like 1

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
kcvinu

Thank you @BrewManNH Let me try. »»»

 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
kcvinu

I am going to drop this project for 2 reasons.

1. Control ID is changing after system restart.

2. "Select", "Item" command in ControlTreeView function is not working properly. 

 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
Starstar

I am going to drop this project for 2 reasons.

1. Control ID is changing after system restart.

2. "Select", "Item" command in ControlTreeView function is not working properly. 

 

​There is no need to discard.Keep it up every problem have a solution....If you are a hard-worker...

$ctrHndl = ControlGetHandle("Tilte".""."[CLASS:Your Class]")
ControlTreeView("PhraseExpress Freeware v10.5.41f","",$ctrHndl,"Select","PhraseExpress|Ahat|#3")

Try like this one.......

 

Edited by Starstar
  • Like 1

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post


Link to post
Share on other sites
kcvinu

Thank you @Starstar for the encouragement. 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
kcvinu

@Starstar , Your code didn't work. After that i tried this, but didn't work. see this

Local $classlist = WinGetClassList("PhraseExpress Freeware v10.5.41f")
Local $ID = ControlGetHandle("PhraseExpress Freeware v10.5.41f","","[CLASS:TVirtualStringTree]")
Local $count = ControlTreeView("PhraseExpress Freeware v10.5.41f","",$ID,"GetItemCount","PhraseExpress|Ahat" )

 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
LarsJ

Share this post


Link to post
Share on other sites
kcvinu

From the helpfile: ControlTreeView sends a command to a TreeView32 control. Are you sure this is a TreeView32 control?

​Commands like "GetItemCount, GetText" are worked very well for this control. And it really looks like a treeview control.Please see the image in my first post. But "Basic Control Info" in Window Info Tool is empty. 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
LarsJ

For a TreeView32 control the class name in AutoIt Window Info tool will be something like SysTreeView321 as in Windows Explorer left pane treeview control.

Share this post


Link to post
Share on other sites
kcvinu

 @LarsJ Here is screenshot of window info tool

 

 000042.jpg


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites
LarsJ

I'm pretty sure it's not a TreeView32 control. It's for this reason that ControlTreeView doesn't work. You can probably automate the treeview with the UI Automation framework.

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

  • Similar Content

    • jdegraff
      By jdegraff
      I'm trying to add a bit of functionality to the FastStone File Rename dialog. I can access every control that I need to except the one that contains the files to be renamed. If I do some exploring in a vbScript shell I get
      :c  = "TTntTreeView.UnicodeClass1"
      :?aut.ControlTreeView(win,"",c,"GetItemCount","","")
      5
      You can see that the treeview control reports having five items, which is the number displayed. If I manually select (mouse) item #3 I can see the result by
      :?aut.ControlTreeView(win,"",c,"GetSelected","1","")
      #3
      But I do not know how to get the text for the selected item. If "#3" is the item reference then I should be able to
      :?aut.ControlTreeView(win,"",c,"GetText","1","#3")
      or
      :?aut.ControlTreeView(win,"",c,"GetText","1","#3")
      if I go strictly by the help file, but it returns nothing.
      :?aut.ControlTreeView(win,"",c,"Exists","","3")
      1
      So it appears that item 3 exists, but
      :?aut.ControlTreeView(win,"",c,"GetText","","3")
      does not have any text???
      :?aut.ControlTreeView(win,"",c,"Exists","","9")
      1
      and it also appears item 9 exists (it does not)
      :?aut.ControlTreeView(win,"",c,"Select","","")
      1
      causes the first item to be selected, as does
      :?aut.ControlTreeView(win,"",c,"Select","","3")
      1
      Here is the output from the Window Info tool
      >>>> Window <<<<
      Title:  Batch Image Convert / Rename
      Class:  TBatchConvert
      Position:   501, 83
      Size:   760, 520
      Style:  0x16CD0000
      ExStyle:    0x00010100
      Handle: 0x0000000001950796
      >>>> Control <<<<
      Class:  TTntTreeView.UnicodeClass
      Instance:   1
      ClassnameNN:    TTntTreeView.UnicodeClass1
      Name:   
      Advanced (Class):   [CLASS:TTntTreeView.UnicodeClass; INSTANCE:1]
      ID: 37030040
      Text:   
      Position:   354, 79
      Size:   378, 188
      ControlClick Coords:    108, 86
      Style:  0x54010039
      ExStyle:    0x00000200
      Handle: 0x0000000002350898
      >>>> Mouse <<<<
      Position:   970, 279
      Cursor ID:  0
      Color:  0xE1E1E1
      >>>> StatusBar <<<<
      >>>> ToolsBar <<<<
      >>>> Visible Text <<<<
      Batch Rename
      ...
      D:\temp\picsave\
      Images + Videos (*.jpg;*.jpe;*.jpeg;*.bmp;*.gif;*.tif;*.tiff;*.cur;*.ico;*.png;*.pcx;*.jp2;*.j2k;*.tga;*.ppm;*.wmf;*.psd;*.crw;*.nef;*.cr2;*.orf;*.raf;*.dng;*.mrw;*.pef;*.srf;*.arw;*.rw2;*.x3f;*.sr2;*.srw;*.nrw;*.rwl;*.eps;*.avi;*.mpeg;*.mpg;*.wmv;*.mov;*.mp4;*.mts;*.mkv;*.m4v)
      Search and Replace
      Use Filename Template
      No Sort
      Clear
      Remove
      Add All
      Add
      Preview
      Close
      Rename
      No Change
      ?
       
       


    • ur
      By ur
      if ControlClick("[CLASS:MsiDialogCloseClass]"," ","[CLASS:SysTreeView32; INSTANCE:1]") Then $htreeview=ControlGetHandle($hwnd,"","[CLASS:SysTreeView32; INSTANCE:1]") ControlTreeView($hwnd," ",$htreeview,"Select","#4") The above code worked well to enable the martupgrade feature on windows 7.
      As part of our Installation Testing Automation before delivering the installer to end user.To confirm whether all the screens are working good.

      But it is not working on windows 10.
       
      $h= ControlTreeView($hwnd," ",$htreeview,"Select","#4") The $h is getting value 1,which means error.
    • tremolux66
      By tremolux66
      I'm automating a commercial app that will copy files/folders from an optical disc to a folder on a hard drive, and am unable to check an item in a SysTreeView32 control in the app's main window. The disc and its top-level folders are displayed as a simple tree, and I've written a test script that probes and manipulates the control by calling ControlTreeView(). The script cannot, on its own, check the desired item in the TreeView, but it can check the item with some manual intervention. I need to know if there's something missing, or if a different approach is needed.
      The operations currently being tested are:
      Waiting until the contents of the TreeView control appear before proceeding (the app can take a long time to display the control contents), and Checking the first item's checkbox (i.e., the disc itself), thus selecting the entire disc contents for copying. The test script can complete the first operation successfully, but not the second: there is a side-effect of the first that apparently causes the second one to fail.
      When the control's contents eventually become visible, they look like this; note the position of the scrollbar:

      The wait is done by repeatedly selecting the first item until @error=0 using the following code fragment (note: the code has been edited for brevity and to remove certain information):
      ; Wait for the DM window to become active ; -- _WinWaitActivate() is from AU3 Recorder-generated code $hWnd1 = _WinWaitActivate($sDMtitle,"") ; Wait for the SysTreeViewList32 control to display its first item $sCtrlAdvMode = "[CLASS:SysTreeView32; INSTANCE:1]" $i = 0 $iRetVal = ControlTreeView($hWnd1,"",$sCtrlAdvMode,"Select","#0") $iAtError = @error While $iAtError <> 0 $i += 1 If $i > 20 Then ExitLoop Sleep(5000) $iRetVal = ControlTreeView($hWnd1,"",$sCtrlAdvMode,"Select","#0") $iAtError = @error WEnd If $i > 20 Then ConsoleWrite("Select: Unable to select 1st item after 20 tries" & @CRLF) This works - the script successfully loops until the contents are visible, but when the item selection finally succeeds, the control contents scroll horizontally, hiding the checkboxes:

      The script then tries to check the first item by calling ControlTreeView() from the following code fragment (again, edited for brevity, etc.):
      ; Check the first item $iRetVal = ControlTreeView($hWnd1,"",$sCtrlAdvMode,"Check","#0") If @error <> 0 Then ConsoleWrite("Check: Unable to check 1st item, return=" & $iRetVal & ", @error=" & @error & ", @extended=" & @extended & @CRLF) $iRetVal = ControlTreeView($hWnd1,"",$sCtrlAdvMode,"IsChecked","#0") ConsoleWrite("IsChecked: return=" & $iRetVal & ", @error=" & @error & ", @extended=" & @extended & @CRLF) The Check call always returns @error=1, and the IsChecked call returns without error, but with a value of False. (The boxes remain unchecked on the screen as well.)
      HOWEVER: With some experimentation I discovered that if I put a pause in the test script so that I can manually scroll the TreeView to make the checkboxes visible, then the Check call works - the boxes in the control are all checked, and the IsChecked call returns True.
      Any suggestions for making this work under program control (no manual intervention)? The application needs to be completely automated.
      Note: I have tried another method for the wait-loop (getting the first item's checkbox value), hoping it would achieve the desired result without scrolling the tree. However, the IsChecked call returns with @error=0 (and False) on the first call, long before the tree was visible.
       
    • Brian39
      By Brian39
      Hi,
      I have made a script for SAP application. I use the "MouseClick" to click on the arrow left of "HR" to expand tree. Then "MouseClick" to double click on "Tidsregistrering". This work fine but I would like to use something like "ControlTreeView" to expand the "HR" folder and "ControlClick" to activate "Tidsregistrering".
      I have attached a screendump with "Autoit window info". But I cant get it to work.
      To expand the "HR" folder I use: ControlTreeView("SAP Easy Access", "", "[iD:100]", "Expand")
      To enter "Tidsregistrering" menu I use: ControlClick("SAP Easy Access", "", "[iD:100]")

      Hopefully someone could point me in the right direction

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.