Sign in to follow this  
Followers 0
Valhalla1

need help working with Unicode characters in clipboard text

4 posts in this topic

#1 ·  Posted (edited)

I'm trying to automate a process, and I've run into a snag.. I have a 3rd party application which generates some text that I need to work with in autoit

unfortunately its giving me trouble, because it uses unicode characters in the text . specifically these four which represet card suits:

♠♦♥♣

this program outputs some text to the clipboard, I need autoit to dump that clipboard data to a text file.

Right now using ClipGet() and FileWrite it strips all the unicode out and sends only ?'s. I open the file with mode 16 Unicode, but still strips them. I've tried modes 32, 128.. same result

$results = ClipGet()
FileOpen("z:\test.txt",16)
FileWrite ( "z:\test.txt", $results )
FileClose("z:\test.txt")

I've tried a seperate tool, swiss file knife CLI text program which has a clipboard-to-text function but it has the same issue, it outputs ??'s

How can I output this clipboard data to a text file easily ?

The problem seems to be with FileWrite and not ClipGet(), because if I have autoit show me a MsgBox with the ClipGet() data it shows the unicode card suits just fine

Edited by Valhalla1

Share this post


Link to post
Share on other sites



an ugly hack is to have autoit open Notepad.exe, paste the clipboard data, save the file and select Unicode in the dropdown on the save dialog gui, then close notepad.

this however is slow, ugly hack, and unstable. I need this process to be smoothly integrated in my autoit so accomplished within autoit or a simple CLI tool

Share this post


Link to post
Share on other sites

When using FileOpen you will get a handle, when you later use FileWrite and FileClose the handle should be used instead of the filename. Therefore this works perfectly :D

$data=ClipGet()
$handle=FileOpen("test.txt",65)
FileWrite($handle,$data)

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

When using FileOpen you will get a handle, when you later use FileWrite and FileClose the handle should be used instead of the filename. Therefore this works perfectly :D

$data=ClipGet()
$handle=FileOpen("test.txt",65)
FileWrite($handle,$data)

wow, no kidding. thanks so much

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  
Followers 0