Sign in to follow this  
Followers 0
mikhael

Help with a SysListView32 control

14 posts in this topic

I'm trying to automate an installer for a Xerox printer and I'm getting stuck early on in the installer. I've got a SysListView32 control that so far everything I've tried I can't interact with it. What I'm trying to do is send a command to clear all selected options and then re-select 3 options. Below is a screenshot and the AU3INFO for the box that the options reside in:

Posted Image

>>>> Window <<<<

Title: Xerox Phaser 3200MFP

Class: Xerox Phaser 3200MFP Installer Program

Position: 207, 204

Size: 556, 386

Style: 0x14C80000

ExStyle: 0x00040100

Handle: 0x003102EC

>>>> Control <<<<

Class: SysListView32

Instance: 1

ClassnameNN: SysListView321

Name:

Advanced (Class): [CLASS:SysListView32; INSTANCE:1]

ID: 1009

Text: List1

Position: 260, 60

Size: 260, 100

ControlClick Coords: 46, 56

Style: 0x5021410D

ExStyle: 0x00000204

Handle: 0x004402E8

>>>> Mouse <<<<

Position: 516, 343

Cursor ID: 0

Color: 0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

Xerox Phaser 3200MFP

List1

Next>

Select components

If you wish to install a particular software components, check the box to the left of its name.

Cancel

< Back

>>>> Hidden Text <<<<

Check All

Change Param

Xerox Phaser 3200MFP

Radio1

Next

English

V2.10.21:03

Cancel

Next>

Share this post


Link to post
Share on other sites



All of the commented lines at the bottom were some of my attempts at getting the control to respond in any way.

#RequireAdmin
#include <GuiListView.au3>

Run("Setup.exe")

ControlClick("Open File - Security Warning", "", "[CLASS:Button; INSTANCE:1]")

WinWait("Xerox Phaser 3200MFP", "Next>")
WinActivate("Xerox Phaser 3200MFP", "Next>")
ControlClick("Xerox Phaser 3200MFP", "Next>", "Button8")
Send("{ENTER}")

WinWait("Xerox Phaser 3200MFP", "Select Components")
WinActivate("Xerox Phaser 3200MFP", "Select Components")
Sleep(3000)
ControlListView("Xerox Phaser 3200MFP", "Select Components", "[CLASS:SysListView32; INSTANCE:1]", "SelectAll")
;ControlListView("Xerox Phaser 3200MFP", "", "SysListView321", "Select", 3)
;_GUICtrlListView_SetItemSelected("[CLASS:SysListView32; INSTANCE:1]", 1, "True")
;_GUICtrlListView_SetItemSelected("[CLASS:SysListView32; INSTANCE:1]", 2, "True")
;_GUICtrlListView_SetItemSelected("[CLASS:SysListView32; INSTANCE:1]", 3, "True")
;_GUICtrlListView_SetItemSelected("[CLASS:SysListView32; INSTANCE:1]", 4, "True")

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I tend to grab the handles for the window and contols early in the code and reference those from then on:

$hWin = WinGetHandle("Xerox Phaser 3200MFP", "")
$hLV = ControlGetHandle($hWin, "", "[NAME:SysListView321]")

Does running this return a value?

$iLV_Cnt = ControlListView($hWin, "", $hLV, "GetItemCount")
Msgbox(0, "", "ListView elements: " & $iLV_Cnt)

Edit: Try this one too:

_GUICtrlListView_ClickItem($hLV, 1, "left", True) ; click second item, move cursor
Edited by Spiff59

Share this post


Link to post
Share on other sites

So first I tried:

#RequireAdmin
#include <GuiListView.au3>

$hWin = WinGetHandle("Xerox Phaser 3200MFP", "")
$hLV = ControlGetHandle($hWin, "", "[NAME:SysListView321]")

Run("Setup.exe")

ControlClick("Open File - Security Warning", "", "[CLASS:Button; INSTANCE:1]")

WinWait("Xerox Phaser 3200MFP", "Next>")
WinActivate("Xerox Phaser 3200MFP", "Next>")
ControlClick("Xerox Phaser 3200MFP", "Next>", "Button8")
Send("{ENTER}")

WinWait("Xerox Phaser 3200MFP", "Select Components")
WinActivate("Xerox Phaser 3200MFP", "Select Components")
Sleep(3000)
$iLV_Cnt = ControlListView($hWin, "", $hLV, "GetItemCount")
Msgbox(0, "", "ListView elements: " & $iLV_Cnt)

I never did see a message box pop-up. I ALT-TAB'd out of the installer to see if it was behind the installer's splash screen, but it was not there either. Then I tried:

#RequireAdmin
#include <GuiListView.au3>

$hWin = WinGetHandle("Xerox Phaser 3200MFP", "")
$hLV = ControlGetHandle($hWin, "", "[NAME:SysListView321]")

Run("Setup.exe")

ControlClick("Open File - Security Warning", "", "[CLASS:Button; INSTANCE:1]")

WinWait("Xerox Phaser 3200MFP", "Next>")
WinActivate("Xerox Phaser 3200MFP", "Next>")
ControlClick("Xerox Phaser 3200MFP", "Next>", "Button8")
Send("{ENTER}")

WinWait("Xerox Phaser 3200MFP", "Select Components")
WinActivate("Xerox Phaser 3200MFP", "Select Components")
Sleep(3000)
_GUICtrlListView_ClickItem($hLV, 1, "left", True) ; click second item, move cursor
_GUICtrlListView_ClickItem($hLV, 2, "left", True) ; tried clicking other items just to see if i could get it to do anything
_GUICtrlListView_ClickItem($hLV, 3, "left", True)
_GUICtrlListView_ClickItem($hLV, 4, "left", True)

Still nothing. Script just sits there.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You can't snag the handles for the window or controls until they're created.

Do your "run setup.exe" first.

Then put a ProcessWait("setup.exe") after it, to wait until the program has fully loaded.

Then try to snag the handles and reference the controls.

PS - I'm assuming the process launched is also named "setup.exe", you can launch the program then check the process tab of task manager to confirm that.

Edit: Try this...

#RequireAdmin
#include <GuiListView.au3>

Run("Setup.exe") ; launch program
ProcessWait("Setup.exe") ; wait until it's loaded

$hWin = WinGetHandle("Xerox Phaser 3200MFP", "") ; get window handle
$hLV = ControlGetHandle($hWin, "", "[NAME:SysListView321]") ; get listview handle

$iLV_Cnt = ControlListView($hWin, "", $hLV, "GetItemCount") ; get count of listview rows
Msgbox(0, "", "ListView rows: " & $iLV_Cnt)
Edited by Spiff59

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Ok. So I get a pop-up with "ListView elements:0". Something else I noticed was the first time I ran it the pop-up came up pretty quick, like before the loading screen finished even though there is a ProcessWait in there now. You are correct the process on the Process Tab in Taskmgr is "Setup.exe". So next I tried just manually kicking the installer off and getting it to the listview screen and then I ran the code again, minus the Run and Processwait, but ended up with the same results "ListView elements:0". The last attempt I added in a Sleep(15000) before the GetItemCount and still got "ListView elements:0".

Something else I've noticed that maybe worth noting...the screen before the listview is for language selection. It's already defaulted for English so you just click Next or Cancel. I was looking back over my code:

WinWait("Xerox Phaser 3200MFP", "Next>")
WinActivate("Xerox Phaser 3200MFP", "Next>")
ControlClick("Xerox Phaser 3200MFP", "Next>", "Button8")
Send("{ENTER}")

I was trying to figure out why I'd put that extra ENTER command in. Then I remembered that the ControlClick command above doesn't actually click the NEXT button. I can see it set the focus on the button, but it won't actually press it. In fact if I throw in another ControlClick for Button7, which is Cancel, I can see it toggle back and forth but neither actually gets pressed.

Edited by mikhael

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Odd, those buttons seems resistant to ControlClick()

The helpfile mentions using WinActivate() if necessary, but that seems to have no effect.

The buttons are being recognized and get focus, they just don't click.

The example below has extra ControlClick() and Sleep() commands just to visually demonstrate that the Window is "live" and the controls being found. A work-around is using Send() after the button is selected, but it's not the way it's supposed to work

Maybe someone else can pipe in with a suggestion...

#RequireAdmin
#include <GuiListView.au3>

$sWinClass = "[CLASS:Xerox Phaser 3200MFP Installer Program]"

Run(@ScriptDir & "Setup.exe") ; launch program
WinWaitActive($sWinClass) ; wait until progress bar is finished and full window is open

$hWin = WinGetHandle("Xerox Phaser 3200MFP", "") ; get window handle

;ControlCommand($hWin, "", "[CLASSNN:ComboBox1]", "SelectString", "English")
;WinWaitActive($sWinClass) ; wait until window is redrawn (only needed if switching away from default language)

ControlClick($hWin, "", "[CLASSNN:Button8]")
sleep(1000)
ControlClick($hWin, "", "[CLASSNN:Button7]")
sleep(1000)
ControlClick($hWin, "", "[CLASSNN:Button8]")
sleep(1000)
ControlClick($hWin, "", "[CLASSNN:Button7]")
sleep(1000)
ControlClick($hWin, "", "[CLASSNN:Button8]")
sleep(1000)
Send("{ENTER}")

WinWaitActive($sWinClass) ; wait until window is redrawn
$hLV = ControlGetHandle($hWin, "", "[NAME:SysListView321]") ; get listview handle
$iLV_Cnt = ControlListView($hWin, "", $hLV, "GetItemCount") ; get count of listview rows

Msgbox(0, "", "ListView rows: " & $iLV_Cnt)

Edit: lol, I typed this without reading all of you prior post first. You understand exactly the odd behavior with ControlClick() that I described (just as you had) above! So, do you get a count of the listview rows from the above script???

Edited by Spiff59

Share this post


Link to post
Share on other sites

Ok that last bit of code returned "ListView elements:7" and there are 7 possible options to check.

Share this post


Link to post
Share on other sites

Well, that ought to be enough to get you going for a while...

You'll want commands like _GUICtrlListView_ClickItem($hLV, $row, "left") and other related commands from the helpfile.

Again, maybe someone sharper will have a fix for having to use the Send() command to click buttons.

Share this post


Link to post
Share on other sites

So here's what I've tried so far:

#RequireAdmin
#include <GuiListView.au3>

$sWinClass = "[CLASS:Xerox Phaser 3200MFP Installer Program]"
Run(@ScriptDir & "\Setup.exe") ; launch program
WinWaitActive($sWinClass) ; wait until progress bar is finished and full window is open
$hWin = WinGetHandle("Xerox Phaser 3200MFP", "") ; get window handle

;ControlCommand($hWin, "", "[CLASSNN:ComboBox1]", "SelectString", "English")
;WinWaitActive($sWinClass) ; wait until window is redrawn (only needed if switching away from default language)

ControlClick($hWin, "", "[CLASSNN:Button8]")
sleep(1000)
ControlClick($hWin, "", "[CLASSNN:Button7]")
sleep(1000)
ControlClick($hWin, "", "[CLASSNN:Button8]")
sleep(1000)
ControlClick($hWin, "", "[CLASSNN:Button7]")
sleep(1000)
ControlClick($hWin, "", "[CLASSNN:Button8]")
sleep(1000)
Send("{ENTER}")

WinWaitActive($sWinClass) ; wait until window is redrawn
$hLV = ControlGetHandle($hWin, "", "[NAME:SysListView321]") ; get listview handle
$iLV_Cnt = ControlListView($hWin, "", $hLV, "GetItemCount") ; get count of listview rows
;Msgbox(0, "", "ListView rows: " & $iLV_Cnt); this returns 7

;since i wasnt having any luck with the commands below i wanted to see if i could get the list to respond to these
MsgBox(4160, "Information", "Item 1 Selected: " & _GUICtrlListView_GetItemSelected($hLV, 0)); all of these return False but i know for a fact the 1st option is always checked
MsgBox(4160, "Information", "Item 2 Selected: " & _GUICtrlListView_GetItemSelected($hLV, 1))
MsgBox(4160, "Information", "Item 9 Selected: " & _GUICtrlListView_GetItemSelected($hLV, 10))
MsgBox(4160, "Information", "Item 1 Checked: " & _GUICtrlListView_GetItemChecked($hLV, 0))
MsgBox(4160, "Information", "Item 2 Checked: " & _GUICtrlListView_GetItemChecked($hLV, 1))
MsgBox(4160, "Information", "Item 9 Checked: " & _GUICtrlListView_GetItemChecked($hLV, 10))
_GUICtrlListView_SetItemSelected($hLV, 0, True); none of my attempts to interact with the list were successful
_GUICtrlListView_SetItemSelected($hLV, 1, True)
_GUICtrlListView_SetItemSelected($hLV, 2, True)
_GUICtrlListView_SetItemSelected($hLV, 4)
;_GUICtrlListView_SetItemChecked($hLV, 1, True)
;_GUICtrlListView_SetItemChecked($hLV, 2, True)
;_GUICtrlListView_SetItemChecked($hLV, 4, True)
;_GUICtrlListView_SetItemChecked($hLV, 0, True)
;_GUICtrlListView_SetItemChecked($hLV, 1, True)
;_GUICtrlListView_SetItemChecked($hLV, 2, True)
;_GUICtrlListView_SetItemChecked($hLV, 4, True)
;_GUICtrlListView_ClickItem($hLV, 0, "left")
;_GUICtrlListView_ClickItem($hLV, 1, "left")
;_GUICtrlListView_ClickItem($hLV, 2, "left")
;_GUICtrlListView_ClickItem($hLV, 4, "left")

In case anyone else wants to see the installer I'm trying to automate you can find it on Xerox's site here. It's only 64mb.

Share this post


Link to post
Share on other sites

Hi, mikhael. This install supports the common command line switches, have you tried this rather than trying to automate it screen by screen? Something like this perhaps? Regarding the components you want to select, the ssinst.cmd batch file under the DATA directory seems to hold all of the settings you would want; you should be able to alter this to select the items you need.

RunWait("Setup.exe /s")

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Ok so I've been thinking to myself, IF, I ever figure this thing out it's going to end up being something so simple probably related to the syntax I'm using. Then you go and throw that solution in. I never went down that route because my Xerox rep had previously told me the installer did not support a silent install.

So first I would still like to figure out why my script is not working because I was learning alot from the experience. Second, JLogan3013 do you have experience with Xerox installers? Or what did you see that made you think to try the silent switch? Or did you just try it to try it? Because now I've got some new questions:

Setup.exe /? doesn't return a list of available options. Neither did Google for Xerox Phaser 3200 setup.exe /s.

Setup.exe /s definitely kicks off the installer because I can see it in the tasklist, but I'm not sure if its just hidden and waiting at the first screen. Or if its actually indeed running thru some sort of default install.

I took a look at the ssinst.cmd file and none of the options stood out as to what I was looking for, but that made me think to look for other files. So I opened up setup.dat and found what I was looking for there. I found the options I wanted to have checked by default and just had to put "CHK" next to them. So technically I could just go back to my AutoIt script now and hammer ENTER all the way thru the screens. I've got it running thru the install right now though with the modified .dat and it's moving really slow here at the end. Normally it's like a 4 minute install and it's gone way over that already.

Perhaps editing that .dat file in notepad wasn't a good idea, but I'll see. It hasn't stopped responding yet.

Share this post


Link to post
Share on other sites

Hi, mikhael. To answer your question about the silent install, I have done a little with Xerox installs. Mainly, I've been repackaging software for 10 years or so, and just know that most companies provide some sort of automated install, even if they don't publish it ;)

If this particular install is giving you fits, I would normally suggest repackaging the install into an MSI. That way you can specify whatever options you would like, then call the MSI with AutoIt if necessary. You might look into WiX as a free utility for this.


√-1 2^3 ∑ π, and it was delicious!

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
Sign in to follow this  
Followers 0