Modify

Opened 15 years ago

Closed 15 years ago

#709 closed Bug (Fixed)

WinGetTitle() returning '[SOH]' character, instead of title of target window.

Reported by: anonymous Owned by:
Milestone: 3.2.13.12 Component: AutoIt
Version: 3.2.13.11 Severity: None
Keywords: WinGetTitle Cc:

Description

#cs ----
	issue: WinGetTitle(...) returning '[SOH]' character, instead of title of target window.
	- $Title = WinGetTitle("classname=<progname>")
	- $Title = WinGetTitle(<progHandle>)
	- (3.2.13.11), WinGetTitle(...), returnData '[SOH]'
	- (3.2.13.10), WinGetTitle(...), returnData '<winTitle>'
#ce ----

Global $TargetApp_FileSpec = ''
Global $TargetApp_ClassName = ''
Global $TargetApp_ClassSpec = ''

Switch 1
	Case 1
		$TargetApp_FileSpec = 'notepad.exe'
		$TargetApp_ClassName = 'Notepad' ;; default windows Notepad.
	Case 2
		$TargetApp_FileSpec = 'calc.exe'
		$TargetApp_ClassName = 'SciCalc' ;; (Calculator Plus)
EndSwitch

$TargetApp_ClassSpec = '[CLASS:' & $TargetApp_ClassName & ']'
ConsoleWrite('$TargetApp_ClassSpec = ' & $TargetApp_ClassSpec & @CRLF)

F1()
ConsoleWrite('-9-' & @CRLF)
Exit 0

Func F1()
	If Not WinExists($TargetApp_ClassSpec) Then
		Run($TargetApp_FileSpec)
		If WinWait($TargetApp_ClassSpec, '', 2) Then
			ConsoleWrite('WinWait(*): OK' & @CRLF)
			F2()
		Else
			ConsoleWrite('WinWait(*) Failed, $TargetApp_ClassSpec = ' & $TargetApp_ClassSpec & @CRLF)
			Exit 1
		EndIf
	Else
		F2()
	EndIf
EndFunc   ;==>F1

Func F2()
	WinActivate($TargetApp_ClassSpec)
	If WinWaitActive($TargetApp_ClassSpec, '', 2) Then
		ConsoleWrite('WinWaitActive(*)1: OK' & @CRLF)
		F3()
	Else
		ConsoleWrite('WinWaitActive(*) Failed, $TargetApp_ClassSpec = ' & $TargetApp_ClassSpec & @CRLF)
		Exit 1
	EndIf
EndFunc   ;==>F2

Func F3()
	Local $TargetApp_Handle
	$TargetApp_Handle = WinGetHandle($TargetApp_ClassSpec)
	ConsoleWrite('$TargetApp_Handle = ' & $TargetApp_Handle & @CRLF)
	
	Local $TargetApp_Title
	ConsoleWrite(@CRLF)
	
	For $i = 1 to 4
		Opt("WinTitleMatchMode", $i) ;; 1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
		ConsoleWrite('WinTitleMatchMode = ' & $i & @CRLF)
	
		$TargetApp_Title = '-'
		$TargetApp_Title = WinGetTitle($TargetApp_Handle)
		ConsoleWrite('1) $TargetApp_Title = ' & $TargetApp_Title & @CRLF)
		
		$TargetApp_Title = '-'
		$TargetApp_Title = WinGetTitle($TargetApp_ClassSpec)
		ConsoleWrite('2) $TargetApp_Title = ' & $TargetApp_Title & @CRLF)
		
		$TargetApp_Title = '-'
		$TargetApp_Title = WinGetTitle("[active]")
		ConsoleWrite('3) $TargetApp_Title = ' & $TargetApp_Title & @CRLF)
		
		ConsoleWrite(@CRLF)
	Next

EndFunc   ;==>F3

Attachments (0)

Change History (2)

comment:1 Changed 15 years ago by TicketCleanup

  • Severity changed from Blocking to None

Automatic ticket cleanup.

comment:3 Changed 15 years ago by Valik

  • Milestone set to 3.2.13.12
  • Resolution set to Fixed
  • Status changed from new to closed

It will be fixed in 3.2.13.12.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.