AutoHotkey Community

It is currently May 27th, 2012, 6:09 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: October 30th, 2010, 4:28 pm 
Offline

Joined: November 15th, 2009, 2:33 pm
Posts: 6
Location: Sweden
It's quite straight forward: I want to be able to mark something, press ctrl+c to put it into the clipboard buffer, then press a hotkey that will save the clipboard buffer to file.

Even better would be if I could replace all unicode characters (eg. everything not in ASCII) with some letter combination, preferably something like U3432 etc.

What I want to be able to do is to run a python script from the clipboard. Python doesn't have full unicode support (for example, I can't use λ as a variable name and so on), so I'd like to change all unicode characters to a letter combination (something like λ gets turned into U3BB, which is an acceptable variable name in Python, so "λ = someFunction(3); print(λ)" would become "U3BB = someFunction(3); print(U3BB)", which is legal python code).

Right now, I'm using
Code:
IfExist, c:\pythoncode.py ;removes file if it already exists
        FileDelete, c:\pythoncode.py
   
    Transform, ClipUTF, Unicode
   
    FileAppend, # -*- coding: utf-8 -*-`r`n, c:\pythoncode.py
    FileAppend, %Clipboard%, c:\pythoncode.py ;writes clipboard to file
   
    Run, python -i c:\pythoncode.py


What's missing is the unicode → "ascii representation" part. How would I do this? Can I do it all in Autohotkey?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2010, 5:29 pm 
Offline

Joined: December 23rd, 2006, 6:02 pm
Posts: 424
Location: Russia
Use the Unicode build of AutoHotkey_L. Save the clipboard text to a string (it will be Unicode) and replace any character with what you want. Then save the string to a file in whatever encoding you like.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], HotkeyStick, Wicked and 60 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group