Sign in to follow this  
Followers 0
xavierh

Notepad crashes on Win7 or 2008R2 when using ControlListView GetText

2 posts in this topic

I have an automation system that selects a printer from the Print dialog of Notepad.

It works fine under XP 32 or 64, or on 64 bit win2008R1. But it crashes Notepad on 64 bit Windows 7 or 2008R2.

This happens when I try to verify that the printer selection was done correctly, with this code:

$SelectionIndex = ControlListView ( "Print", "", "[CLASS:SysListView32; INSTANCE:1]", "GetSelected", "" ) ; get the index of the selection

$sSelectedPrn = ControlListView ( "Print", "", "[CLASS:SysListView32; INSTANCE:1]", "GetText", $SelectionIndex ) ; get the text from the index

Return StringLower ( $PPDPrinterToSelect ) = StringLower ( $sSelectedPrn )

I verified that the selection index returned first is correct, but the next statement makes Notepad crash.

I tried ControlCommand with GetCurrentSelection, and $sSelectedPrn = _GUICtrlListView_GetItemText ( $hwnd, $sSelectedPrn ) but both return nothing.

My current (scary) solution is to use WMI to get the list of installed printers, sort it, and check if $arInstalledPrinters[selectionIndex] matches with $PPDPrinterToSelect.

Any better ideas?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Since I do not use Win7 64, it is difficult to replicate this feat ...

But try to compile your script with the option:

#AutoIt3Wrapper_UseX64=Y                                                ;(Y/N) Use X64 versions for AutoIt3_x64 or AUT2EXE_x64. Default=N
Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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