 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Casper
Joined: 01 Jun 2006 Posts: 21 Location: Denmark
|
Posted: Mon Mar 16, 2009 9:38 am Post subject: How to copy/paste special chacters (other langauges)? |
|
|
Hi,
I've tried searching the forum for a solution, but I haven't been able to find any.
Seems to me, that if I take a copied text (f.x. czech characters) and place it in a variable, then it is translated into western characters!
The below is just an exampel - if I mark a czech letter like č and run the code, then I'm seeing a normal c
| Code: |
Send, {Ctrl Down}c{Ctrl Up} ; copy
Sleep, 200
Textcopy=%clipboard% ;put copied text to variable
msgbox, %Textcopy% ;now it's translated to western characters :-(
return |
Is there a workaround to this, which I'm just oblivious to? _________________ Casper |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4367 Location: Qld, Australia
|
Posted: Mon Mar 16, 2009 10:04 am Post subject: |
|
|
Interestingly, č turns into c( on my system. Unfortunately, AutoHotkey does not support unicode, which is used by the OS to support many languages. There are workarounds, but they depend on what you're trying to accomplish.
If you simply want to save and restore the clipboard contents, preserving unicode, use ClipboardAll instead of Clipboard. |
|
| Back to top |
|
 |
Casper
Joined: 01 Jun 2006 Posts: 21 Location: Denmark
|
Posted: Mon Mar 16, 2009 10:15 am Post subject: |
|
|
| Lexikos wrote: | Interestingly, č turns into c( on my system. Unfortunately, AutoHotkey does not support unicode, which is used by the OS to support many languages. There are workarounds, but they depend on what you're trying to accomplish.
If you simply want to save and restore the clipboard contents, preserving unicode, use ClipboardAll instead of Clipboard. |
Thanks for the reply!
The purpose of the script is to copy the text from a excel field and paste it to a field on a intranet site (I'm creating users from a excel sheet)
I'm not able to make this clipboardall thing to work tho. If I try to replace clipboard with clipboardall, then it almost seems random what I get.. either way it doesn't work for me
| Code: | #y::
Send, {Ctrl Down}c{Ctrl Up} ; copy
Sleep, 200
Textcopy=%clipboardall%
msgbox, %Textcopy%
return |
_________________ Casper |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4367 Location: Qld, Australia
|
Posted: Mon Mar 16, 2009 11:09 am Post subject: |
|
|
ClipboardAll retrieves all of the clipboard contents, in every format available. It is not text, so cannot be displayed by MsgBox. var:=ClipboardAll ... Clipboard:=var will work.
If you only need to copy and paste, why even bring the text into AutoHotkey? That is, would Send ^c ... Send ^v do the job? |
|
| Back to top |
|
 |
Casper
Joined: 01 Jun 2006 Posts: 21 Location: Denmark
|
Posted: Mon Mar 16, 2009 12:57 pm Post subject: |
|
|
| Lexikos wrote: | ClipboardAll retrieves all of the clipboard contents, in every format available. It is not text, so cannot be displayed by MsgBox. var:=ClipboardAll ... Clipboard:=var will work.
If you only need to copy and paste, why even bring the text into AutoHotkey? That is, would Send ^c ... Send ^v do the job? |
Ah oki, i can see ^c and ^v works.
It is sort of an issue for me still tho, since I'll have to bring multipal fields from excel to the webpage - and now I have to tap between the two windows constantly
How do I do the ClipboardAll to var thing before pasting it? - I just can't seem to figure it out. _________________ Casper |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4367 Location: Qld, Australia
|
Posted: Mon Mar 16, 2009 1:22 pm Post subject: |
|
|
| Quote: | | and now I have to tap between the two windows constantly | You could copy each field into its own variable before switching windows, or use ControlSend to avoid ever activating the windows.
| Quote: | | How do I do the ClipboardAll to var thing before pasting it? | I've already said, var:=ClipboardAll ... Clipboard:=var. The first part copies the current clipboard contents into a variable, and the second copies it back into the clipboard. (... denotes code between the two to make it useful.)
Here is an example which I've tested in the forum reply box:
| Code: | KeyWait, RCtrl, D
KeyWait, RCtrl
; Save initial clipboard contents.
FirstClip := ClipboardAll
; Start of document.
Send ^{Home}
Loop 5
{
Clipboard =
; Select and copy line.
Send {Home 2}+{End}^c
ClipWait, 1, 1
if ErrorLevel
break
; Save line in variable.
line%A_Index% := ClipboardAll
; Move to next line.
Send {Down}
}
Run notepad
WinWaitActive, ahk_class Notepad
Loop 5
{
; Paste line.
Clipboard := line%A_Index%
Send ^v`n
; Give some time for the target to process it (not always necessary).
Sleep, 500
}
; Restore initial clipboard contents.
Clipboard := FirstClip | Run the script, then activate an edit box and press RCtrl to begin. |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1046
|
Posted: Mon Mar 16, 2009 4:38 pm Post subject: |
|
|
You might want to check out Transform -> Unicode. _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|