Jump to content

Recommended Posts

Posted

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
Posted

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

Posted

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.

  • 4 weeks later...
Posted (edited)

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
Posted

I don't know how to answer that. The text can be placed anywhere, and new "different" text can be placed anywhere as many times as you like. Any one text or text group can be destroyed on command. chronological order is not needed

8)

NEWHeader1.png

Posted

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.

  • 2 weeks later...
Posted

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.

Posted

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.

  • 2 weeks later...
Posted

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

Posted (edited)

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

Posted

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

Posted

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

  • 4 months later...
Posted

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

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...