Jump to content

Copying text and also its font to the clipboard


anks
 Share

Recommended Posts

Hi All,

I am facing a issue where i have to Get the text from an application, and paste that text in the clipboard. The text copied to clipboard should be in the same format as that of the application.

For ex: if Application font is Verdana, the text getting saved should have verdana font.

Please look the snippet of code written by me:

#Include <ExcelBMS.au3>
#Include <BMS.au3>
#Include <Clipboard.au3>

$text = ControlGettext("Building Management System - Engineering", "", "[NAME:label1]")
msgbox(0,"",$text)

$ret = _ClipBoard_SetData($text,$CF_TEXT)
msgbox(0,"",$ret)

I am able to save the text on clipboard but the font is not getting saved in the same format.

Any body who know regarding this please help me....

Thank you.!!

~Ankita

Link to comment
Share on other sites

Try this and report back:

#include <ExcelBMS.au3>
#include <BMS.au3>
#include <Clipboard.au3>

_ClipBoard_RegisterFormat("Rich Text Format")

$text = ControlGetText("Building Management System - Engineering", "", "[NAME:label1]")
MsgBox(0, "", $text)

$ret = _ClipBoard_SetData($text, $CF_TEXT)
MsgBox(0, "", $ret)
Link to comment
Share on other sites

Try this and report back:

#include <ExcelBMS.au3>
#include <BMS.au3>
#include <Clipboard.au3>

_ClipBoard_RegisterFormat("Rich Text Format")

$text = ControlGetText("Building Management System - Engineering", "", "[NAME:label1]")
MsgBox(0, "", $text)

$ret = _ClipBoard_SetData($text, $CF_TEXT)
MsgBox(0, "", $ret)

Thanks for the reply

I tried your above code, but i am not able to save the type and size of the font on the clipboard.

My objective is to get the text from an Application and paste the text with same size and type into excel.

Please reply me ...if you have any idea.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...