Jump to content

FreeText.au3 - Place Text Anwhere


Recommended Posts

  • Replies 97
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Create Free Style Text Anywhere... As many as you want! ...with Color and Animation! FreeText.au3 "Ver 2.5.2 " ; 11/26/2008, AutoIt Ver 3.2.12.0 Some of The Functions... Possibly The Best E

Probably the best example yet eXPoSiTIoN... **Remember to drag the 1st Letter to Stop the animation ** ; eXPoSiTIoN... ;********* USER INPUT ************** ; Create a Background GUI? Dim $

Thanks for sharing.

I'm from non-English speaking country.

If $String contains double-byte characters (Chinese, Japanese, and Korean), it does not display properly.

For those who using double-byte characters, it would be useful to use lstrlen instead of StringLen() built-in function.

Func CreateTextRgn(ByRef $CTR_hwnd, $CTR_Text, $CTR_height, $CTR_font = "Microsoft Sans Serif", $CTR_weight = 1000)
    ; ...

;~  DllCall($gdi_dll, "int", "TextOut", "int", $CTR_hDC[0], "int", 0, "int", 0, "str", $CTR_Text, "int", StringLen($CTR_Text))
    Local $CTR_nText = DllCall("kernel32.dll", "int", "lstrlen", "str", $CTR_Text)   
    DllCall($gdi_dll, "int", "TextOut", "int", $CTR_hDC[0], "int", 0, "int", 0, "str", $CTR_Text, "int", $CTR_nText[0])

    ; ...
EndFunc   ;==>CreateTextRgn
Link to post
Share on other sites

Thanks for sharing.

I'm from non-English speaking country.

If $String contains double-byte characters (Chinese, Japanese, and Korean), it does not display properly.

For those who using double-byte characters, it would be useful to use lstrlen instead of StringLen() built-in function.

Func CreateTextRgn(ByRef $CTR_hwnd, $CTR_Text, $CTR_height, $CTR_font = "Microsoft Sans Serif", $CTR_weight = 1000)
    ; ...

;~  DllCall($gdi_dll, "int", "TextOut", "int", $CTR_hDC[0], "int", 0, "int", 0, "str", $CTR_Text, "int", StringLen($CTR_Text))
    Local $CTR_nText = DllCall("kernel32.dll", "int", "lstrlen", "str", $CTR_Text)   
    DllCall($gdi_dll, "int", "TextOut", "int", $CTR_hDC[0], "int", 0, "int", 0, "str", $CTR_Text, "int", $CTR_nText[0])

    ; ...
EndFunc   ;==>CreateTextRgn
Thanks ilzimae!

Can someone test and verify this works???

.... If it does, I will put it on Page #1 because others have asked about this also!!

8)

NEWHeader1.png

Link to post
Share on other sites

Why not use the "TextOutW" function with "wstr" as a parameter. There shouldn't be a need to make a DLL call for a string's length in bytes. I think it's safer to use length in characters, and use Unicode functions wherever possible. I'm still baffled as to why AutoIT will try to call the ANSI versions of DLL functions (see help on DllCall) when it forced everyone to move to Unicode in version 3.3. There are UDF's that need rewrites too because of the move to Unicode, but I guess they must have missed that during the upgrade.

Link to post
Share on other sites
  • 4 weeks later...

hello to all,

try to use this nice script.

i've a question. Is possible to assign free(text) to an 'object' mantain on screen and 'destroy' it when i want ?

My needs are to set floating text in a point of screen to make evidence,

then 'destroy' this text and make evidence to another point ....

anyone can help me?

m.

Edited by myspacee
Link to post
Share on other sites

thank you for reply,

you say destroy on command, can you post some script ?

I've a gui that show 3x3 grid. when press a key i want to make evidence on one single square or

hide others. Can you think i can use textfree engine to do this ?

thank you for all good job and disponibility,

m.

Link to post
Share on other sites
  • 2 weeks later...

Thanks ilzimae!

Can someone test and verify this works???

.... If it does, I will put it on Page #1 because others have asked about this also!!

8)

Hey, I've tried testing it, but it still doesn't seem to work with UTF-8 characters, like ф х ц

If I can get these characters working, then your UDF is going to help me out big time. Unfortunately, total newb at autoit, and don't even know where to start looking to fix the problem.

Link to post
Share on other sites

Hello to all,

I need an idea to show all alphabet (a b c d e f g h i j k l m n o p q r s t u v w x y z) in a circle on desktop.

If letters are 26 and circle has 360 degrees, every letter must have 13° degree (360/26) from other, right ?

Have some difficult to script this, anyone can help ?

thank you,

m.

Link to post
Share on other sites
  • 2 weeks later...

I can say that the create shapes is done without the "CreateTextRgn" and just uses a "label"

... give that a try

8)

hi Valuater,

I couldn't get your script working with Unicode, but the source code and tutorials were a great help in pointing me in the right direction. Cheers,

D

Link to post
Share on other sites

Hello to all,

I need an idea to show all alphabet (a b c d e f g h i j k l m n o p q r s t u v w x y z) in a circle on desktop.

If letters are 26 and circle has 360 degrees, every letter must have 13° degree (360/26) from other, right ?

Have some difficult to script this, anyone can help ?

thank you,

m.

DEMO **** _FreeText_Circle()

... Full or Half Circle

#include <FreeText.au3> ; ver 2.5.2

; FreeText.au3 - Demonstration Code - Circle the Horses... lol
HotKeySet("{ESC}", "Terminate")

Dim $wait = 3000

; you can copy and paste the Functions
_FreeText_Functions()

$BGrnd = _FreeText_CreateBackGround("Random")

ToolTip("Hit (ESC) to Exit", 1, 1, "FreeText", 1)


$TextGUI = _FreeText_Create("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
Sleep($wait)
_FreeText_Circle($TextGUI)
Sleep($wait)

$TextGUI2 = _FreeText_CreateCubes(8, -1, -1, 50)
Sleep($wait)
_FreeText_Shape_SetText($TextGUI2, "Valuater", 30)
Sleep($wait)
_FreeText_Circle($TextGUI2, 0, 500)


While GUIGetMsg() <> -3
WEnd

Func _FreeText_Circle($T_GUI, $Full = 1, $adjust = 200, $delay = 1)
    If Not IsArray($T_GUI) Then Return 0
    Local Const $PI = 3.1415926535897932384626433832795, $Points = UBound($T_GUI)
    Local $Width = (@DesktopWidth - $adjust), $Height = (@DesktopHeight - $adjust), $MidX = $Width / 2, $MidY = $Height / 2
    Local $Step = ($PI * (1 + $Full)) / ($Points - $Full), $Radius = $MidY - ($MidY / $Points)
    For $x = 1 To UBound($T_GUI) - 1
        WinMove($T_GUI[$x][0], "", ($MidX - (Cos($x * $Step) * $Radius)) + ($adjust / 2), ($MidY - (Sin($x * $Step) * $Radius)) + ($adjust / 2))
        Sleep($delay)
    Next
    Return 1
EndFunc   ;==>_FreeText_Circle

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Cool!!!... :)

8)

Edited by Valuater

NEWHeader1.png

Link to post
Share on other sites

Hello!

I really like your script. I've been using it to display subtitles for movies. However, whenever I create a new text, the movie goes out of fullscreen. I would therefore like to update the text rather than create a new one. I looked at the function _FreeText_Shape_SetText. Is this function for updating texts? I tried it and nothing happens. The text stays as it is. How can update my texts?

Best regards,

Schoel

Link to post
Share on other sites

Hello,

Disregard my last post. Found on previous page solution to this. GUISetState(@SW_SHOWNOACTIVATE) works well!

Glad that worked!

I have been testing with GUISetState(@SW_SHOWNOACTIVATE) and think I am going to release the next update replacing all the @SW_SHOW.

8)

NEWHeader1.png

Link to post
Share on other sites
  • 4 months later...

The size, shape and etc are set for the text in the initial creation....

_FreeText_Create($String, $Left = -1, $Top = -1, $Size = 50, $Color = "Black", $Font = "Arial", $Weight = 1000)

However, if you use the "shaped" text, you can re-size with this

Func _FreeText_Shape_SetText($B_GUI, $Text, $Size = 20, $Color = "black", $Font = "Arial", $Weight = 1000, $delay = 20)

8)

NEWHeader1.png

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...