| View previous topic :: View next topic |
| Author |
Message |
Bernd
Joined: 01 Aug 2006 Posts: 17
|
Posted: Sun Oct 08, 2006 11:57 pm Post subject: strange clipboard behaviour |
|
|
Imagine that you don't have the @ symbol on your keyboard. This ahk script should help:
| Code: | :?c* :at#::
ClipSaved := ClipboardAll
Transform, Clipboard, Unicode, @
Send, ^v
Clipboard := ClipSaved
ClipSaved =
return |
Notice that I followed the manual: I stored the clipboard's content in a separate variable, made use of the clipboard [in order to retrieve output in Unicode format] and transferred the original content back to the clipboard.
But when I trigger the hotstring the first time(s) in WinXP, it will send no @ symbol but the original content of the clipboard (which I thought was externalized). Furthermore, this happens also sometimes in between.
I searched the forum but found no related entry.
Does anyone have an explanation? |
|
| Back to top |
|
 |
i3egohan
Joined: 18 Jul 2006 Posts: 201
|
Posted: Mon Oct 09, 2006 12:27 am Post subject: |
|
|
so what are u trying to do send the @ sign? _________________
I3egohan |
|
| Back to top |
|
 |
Bernd
Joined: 01 Aug 2006 Posts: 17
|
Posted: Mon Oct 09, 2006 12:34 am Post subject: |
|
|
I simply type at# - and the script ought to convert this into @.
Usually it does so, but only after the second or third triggering... and sometimes in between, it sends the clipboard's content instead of an @. Or it sends an @, but with a blank space in front of it.
The @ is just an example. Actually I try to replace letter combinations by non-ANSI signs, hence the need for Unicode output. |
|
| Back to top |
|
 |
i3egohan
Joined: 18 Jul 2006 Posts: 201
|
Posted: Mon Oct 09, 2006 12:45 am Post subject: |
|
|
Will this simple code do the trick?
_________________
I3egohan |
|
| Back to top |
|
 |
Bernd
Joined: 01 Aug 2006 Posts: 17
|
Posted: Mon Oct 09, 2006 12:52 am Post subject: |
|
|
No, it will not
I told you, it's about non-ANSI characters. Try
You will end up with something like Ä% or Ȥ… |
|
| Back to top |
|
 |
i3egohan
Joined: 18 Jul 2006 Posts: 201
|
Posted: Mon Oct 09, 2006 12:57 am Post subject: |
|
|
Oh sorry
well ya best get hold of titan he's the man in ask for help _________________
I3egohan |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5112 Location: eth0 ::1
|
Posted: Mon Oct 09, 2006 1:12 am Post subject: |
|
|
Edit: try sending the ASCII code directly, Send, {Asc 64}
btw. i3egohan do you like my pretty userbar? _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
Bernd
Joined: 01 Aug 2006 Posts: 17
|
Posted: Mon Oct 09, 2006 1:23 am Post subject: |
|
|
ASCII code will do for @, but not for š. I need Unicode.
Where exactly shall I put the ClipWait? |
|
| Back to top |
|
 |
d-man
Joined: 08 Jun 2006 Posts: 247
|
Posted: Mon Oct 09, 2006 1:31 am Post subject: |
|
|
| the original code works perfectly for me on 2 diff xp computers. maybe this should be under bugs |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5112 Location: eth0 ::1
|
Posted: Mon Oct 09, 2006 1:32 am Post subject: |
|
|
ClipWait after Transform might work, if not then use Send, %clipboard%. This is slower for long strings of text but seems to be more reliable. _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
Bernd
Joined: 01 Aug 2006 Posts: 17
|
Posted: Mon Oct 09, 2006 1:48 am Post subject: |
|
|
| I tried Send, %clipboard% , but this will turn characters into ? or cut off the diacritical sign from the letter. So I have to stick to ^v. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4032 Location: Pittsburgh
|
Posted: Mon Oct 09, 2006 2:11 am Post subject: |
|
|
| We discussed this many times in the forum. A better solution than sending Ctrl-V with the transformed unicode is described here. |
|
| Back to top |
|
 |
Bernd
Joined: 01 Aug 2006 Posts: 17
|
Posted: Mon Oct 09, 2006 2:17 am Post subject: |
|
|
| I am fine with Ctrl-V. My problem is the strange clipboard behaviour. Sometimes the hotstring sends the original clipboard content instead of the temporary Unicode letter, even if I trigger the same hotstring again and again. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4032 Location: Pittsburgh
|
Posted: Mon Oct 09, 2006 3:11 am Post subject: |
|
|
Try this version: | Code: | :?c* :at#::
ClipSaved := ClipboardAll
ClipBoard =
Transform Clipboard, Unicode, @
ClipWait 2
Send ^v
Clipboard := ClipSaved
ClipSaved =
return |
Windows needs time to set up the clipboard content. If you change it an use it immediately, you may get the old content or nothing. It is a good practice to clear the clipboard, change it and wait until it contains data. Only after that you use it (Ctrl-V).
Still, the linked solution is faster and does not use memory for a copy of the clipboard. The Unicode values are easier to find than the UTF-8 strings the Transform command needs. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5112 Location: eth0 ::1
|
Posted: Mon Oct 09, 2006 11:53 am Post subject: |
|
|
| Laszlo wrote: | | Try this version: | That doesn't work for me, but the linked solution does. Perhaps there is a bug with AutoHotkey? _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
|