AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

strange clipboard behaviour
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Bernd



Joined: 01 Aug 2006
Posts: 17

PostPosted: Sun Oct 08, 2006 11:57 pm    Post subject: strange clipboard behaviour Reply with quote

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
View user's profile Send private message Send e-mail
i3egohan



Joined: 18 Jul 2006
Posts: 201

PostPosted: Mon Oct 09, 2006 12:27 am    Post subject: Reply with quote

so what are u trying to do send the @ sign?
_________________


I3egohan
Back to top
View user's profile Send private message
Bernd



Joined: 01 Aug 2006
Posts: 17

PostPosted: Mon Oct 09, 2006 12:34 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
i3egohan



Joined: 18 Jul 2006
Posts: 201

PostPosted: Mon Oct 09, 2006 12:45 am    Post subject: Reply with quote

Will this simple code do the trick?

Code:
Send, @

_________________


I3egohan
Back to top
View user's profile Send private message
Bernd



Joined: 01 Aug 2006
Posts: 17

PostPosted: Mon Oct 09, 2006 12:52 am    Post subject: Reply with quote

No, it will not Smile

I told you, it's about non-ANSI characters. Try

Code:

Send, š


You will end up with something like Ä% or Ȥ…
Back to top
View user's profile Send private message Send e-mail
i3egohan



Joined: 18 Jul 2006
Posts: 201

PostPosted: Mon Oct 09, 2006 12:57 am    Post subject: Reply with quote

Oh sorry

well ya best get hold of titan he's the man in ask for help
_________________


I3egohan
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5112
Location: eth0 ::1

PostPosted: Mon Oct 09, 2006 1:12 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Bernd



Joined: 01 Aug 2006
Posts: 17

PostPosted: Mon Oct 09, 2006 1:23 am    Post subject: Reply with quote

ASCII code will do for @, but not for š. I need Unicode.

Where exactly shall I put the ClipWait?
Back to top
View user's profile Send private message Send e-mail
d-man



Joined: 08 Jun 2006
Posts: 247

PostPosted: Mon Oct 09, 2006 1:31 am    Post subject: Reply with quote

the original code works perfectly for me on 2 diff xp computers. maybe this should be under bugs
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5112
Location: eth0 ::1

PostPosted: Mon Oct 09, 2006 1:32 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Bernd



Joined: 01 Aug 2006
Posts: 17

PostPosted: Mon Oct 09, 2006 1:48 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Laszlo



Joined: 14 Feb 2005
Posts: 4032
Location: Pittsburgh

PostPosted: Mon Oct 09, 2006 2:11 am    Post subject: Reply with quote

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
View user's profile Send private message
Bernd



Joined: 01 Aug 2006
Posts: 17

PostPosted: Mon Oct 09, 2006 2:17 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Laszlo



Joined: 14 Feb 2005
Posts: 4032
Location: Pittsburgh

PostPosted: Mon Oct 09, 2006 3:11 am    Post subject: Reply with quote

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
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5112
Location: eth0 ::1

PostPosted: Mon Oct 09, 2006 11:53 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group