Valhalla1 Posted April 22, 2008 Posted April 22, 2008 (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 autoitunfortunately 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 April 22, 2008 by Valhalla1
Valhalla1 Posted April 22, 2008 Author Posted April 22, 2008 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
monoceres Posted April 22, 2008 Posted April 22, 2008 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 $data=ClipGet() $handle=FileOpen("test.txt",65) FileWrite($handle,$data) Broken link? PM me and I'll send you the file!
Valhalla1 Posted April 22, 2008 Author Posted April 22, 2008 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 $data=ClipGet() $handle=FileOpen("test.txt",65) FileWrite($handle,$data) wow, no kidding. thanks so much
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now