Author Topic: Change font  (Read 4861 times)

0 Members and 1 Guest are viewing this topic.

Offline relax

  • Sir
  • ***
  • Posts: 562
  • Cookies: 114
  • The one and only
    • View Profile
Change font
« on: November 16, 2012, 11:04:09 am »
so writing a small script in autoit v3 and im totaly new and dont even know if the program is powerful enouf

so i want the program to write out clipboard content with different font type

im using autoit because it has a easy
Code: [Select]
WinActivate()function

heres the problem:
when i copy text to my clipboard it is formated with size and type
when i paste it to the window i want it to, the pasted text format persists witch is good.
but i want to change the font type and possible the font size.

im a bit comfused because ill use a Raw clipviewer and the text dose not have any tags or code its just clear text.

if this cant be done in autoit im open for sugestions for other languages.

Edit: actually it dosent have to have anything with clipboard to do because its going to be reading from a text file.


Relax formated text
« Last Edit: November 16, 2012, 11:09:10 am by relax »

Offline geXXos

  • Royal Highness
  • ****
  • Posts: 646
  • Cookies: 178
    • View Profile
Re: Change font
« Reply #1 on: November 16, 2012, 11:14:42 am »
Take a look here is a udf made from a user in AutoIt forum.( yes it can be done )
http://www.autoitscript.com/forum/topic/81267-clipboard-getall-clipboard-putall-clipboard-wait/

Offline relax

  • Sir
  • ***
  • Posts: 562
  • Cookies: 114
  • The one and only
    • View Profile
Re: Change font
« Reply #2 on: November 16, 2012, 11:48:01 am »
hmm that dossent change the font type of clipboard or even show the format type in clipboard
:/

Offline geXXos

  • Royal Highness
  • ****
  • Posts: 646
  • Cookies: 178
    • View Profile
Re: Change font
« Reply #3 on: November 16, 2012, 12:09:54 pm »
Relax if i understand correctly  you want to print the content of your clipboard in your AutoIt Gui with a font of your choise ?


Something like that



Code: [Select]
#include <GUIConstantsEx.au3>


Example()


Func Example()
    Local $font, $msg


    GUICreate("My GUI default font") ; will create a dialog box that when displayed is centered


    $font = "Comic Sans MS"
    GUISetFont(9, 400, 4, $font) ; will display underlined characters
    GUICtrlCreateLabel("underlined label", 10, 20)


    GUISetFont(9, 400, 2, $font) ; will display underlined characters
    GUICtrlCreateLabel("italic label", 10, 40)


    GUISetFont(9, 400, 8, $font) ; will display underlined characters
    GUICtrlCreateLabel("strike label", 10, 60)


    GUISetState()


    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()


        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example




Offline relax

  • Sir
  • ***
  • Posts: 562
  • Cookies: 114
  • The one and only
    • View Profile
Re: Change font
« Reply #4 on: November 16, 2012, 12:20:24 pm »
nah i wanted to print out the clipboard to an active window (not mine window) with a different font. sry if that was unclear
but after more investegation i realised that the window i want to paste it to dossent support font style, the reason i saw other font styles in the window was because they where written in english by japanese "coding"...
so ill guess ill go back to my previus problem of finding the font that is used in the "active window"
tryed font identifiers but no luck

so if anyone can identify this font id be grateful

edit: yeah tryed online font identifiers and they give me tetria witch is wrong
« Last Edit: November 16, 2012, 12:25:30 pm by relax »

Offline geXXos

  • Royal Highness
  • ****
  • Posts: 646
  • Cookies: 178
    • View Profile
Re: Change font
« Reply #5 on: November 16, 2012, 12:40:16 pm »
You lost me man, anyway the font must be FF Utility

Offline relax

  • Sir
  • ***
  • Posts: 562
  • Cookies: 114
  • The one and only
    • View Profile
Re: Change font
« Reply #6 on: November 16, 2012, 12:44:22 pm »
You lost me man, anyway the font must be FF Utility

nah its not FF Utility


have no idea whats wrong with me latley but i have been thinking like a complete idiot it seems
The font is most likley Tahoma 12pt

admins may lock this.

and geXXos thanks for your help :)
« Last Edit: November 16, 2012, 12:45:14 pm by relax »

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Change font
« Reply #7 on: November 16, 2012, 01:08:56 pm »
There is a difference between RichText and PlainText. If you're reading from a TXT file, then it's just plain text and the way that text appears depends on the viewer. So it if you copy from one viewer and paste it to the same viewer, it's gonna be identical, but if you paste it to some other viewer then it's gonna be like it was.
With richtext you can c/p shit but normal viewers won't read it.

So like you said, there are no tags and extra bytes, so it's plain text and you cannot change any attributes to it.
You could if the text was in HTML form and RTF form.