Jump to content
Sign in to follow this  
Achilles

_StringToPic

Recommended Posts

Hey, I saw a website that converts text to string in order to protect your email address... So I tried it with AutoIt and this is what I got:

(I do realize that your font will affect how this works so you may need to adjust some of the values in the screen capture function)

#include<ScreenCapture.au3>

_StringToPic('Hey, my name is Achilles... What a surprise.', @ScriptDir & '\Heya.bmp')

Func _StringToPic($string, $outPutDir)
    $notepadName = 'Untitled - Notepad';Change if your computer isn't in English

    $pid = Run('notepad.exe');, '', @SW_HIDE)
    WinWait($notepadName)

    WinMove($notepadName, '', 0, 0) 
    
    $clip = ClipGet() 
    ClipPut($string)
    Send('{ENTER}^v{SPACE 4}')
    ClipPut($clip)
    
    $temp = _ScreenCapture_CaptureWnd($outPutDir, WinGetHandle($notepadName), 4, 55, StringLen($string) * 8.5, 77)
    ProcessClose($pid)
EndFunc
I bet there is a better way to do it, but that's one reason why I'm actually posting this.

Share this post


Link to post
Share on other sites

Hi,

You could use gdiplus to drawtext straight onto a bitmap and save it as any image format.

It would eliminate the notepad and send and screencapture.

The trade off would be the code would be a little longer.

Cheers

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  

×
×
  • Create New...