Jump to content
Sign in to follow this  
anks

Recognising Style and size of font

Recommended Posts

anks

Dear All,

While testing an application i have come under a situation where i need to find out the style and the type of font.

Please see the code below:

$Property = _ExcelReadCell($oExcelInput, $Cell, 3)
$Actual   = ControlGetText($Title, "", $Property)

The ControlGettext function retrieves the text, is there any mechanism where i can find the style and the type of font for the text retrieved from ControlGetText function.

Please help me for it.

Thank U

~Akita

Share this post


Link to post
Share on other sites
BugFix

Use this:

#include <Excel.au3>
$path = 'sample.xls'
$oExcel = _ExcelBookOpen($path)
$Cell = 'A1'
ConsoleWrite($oExcel.Range($Cell).Font.Name & @CRLF)

Best Regards BugFix  

Share this post


Link to post
Share on other sites
anks

Use this:

#include <Excel.au3>
$path = 'sample.xls'
$oExcel = _ExcelBookOpen($path)
$Cell = 'A1'
ConsoleWrite($oExcel.Range($Cell).Font.Name & @CRLF)

Thanks Bugfix for the reply...I am able to retrieve the font name in A1 cell by calling the function "Font.Name" using the Excel object.

But for ex: I have the to retrieve the font name of an application built by us how it is possible.

Please find below the code, where i am trying to retrieve the font name of an notepad, but it throws an error:

$ofile = ObjCreate("Wscript.Shell") ;This line is throwing error
msgbox(0,"",$ofile)

$file = FileOpen("d:\trial.txt", 0)
msgbox(0,"",$file)

$handle= ControlGetHandle("trial.txt - Notepad", "", "Edit1") 
msgbox(0,"",$handle)
$var = ControlGetText("trial.txt - Notepad", "", $handle,ofile.font.Name )
msgbox(0,"",$var)

Can u please help me...

Share this post


Link to post
Share on other sites
BugFix

I don't understand your sample with notepad. The notepad own font can you get from registry:

[HKEY_CURRENT_USER\Software\Microsoft\Notepad]

"lfFaceName"="Arial"

ControlGetText can get only text itself. If you want to read out font from source-application, you can try to catch font like done with excel.


Best Regards BugFix  

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  

×