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 

Is AppsKey+[ = š possible ?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
madmax83



Joined: 20 Jul 2007
Posts: 5

PostPosted: Fri Jul 20, 2007 1:56 am    Post subject: Is AppsKey+[ = š possible ? Reply with quote

Hi,

I live in Croatia and to enter some characters (šđčćž) we use cp1250 (latin2)
codepage. But cp1250 layout changes a lot of other keys so I prefer to
use US keyboard.

Is is possible to have this scenario:

1. use EN keyboard layout.
2. make this mapping

AppsKey+[ = š
AppsKey+] = đ
AppsKey+; = č
AppsKey+' = ć
AppsKey+\ = ž

AppsKey would be somewhat like a mode switch...

I use that layout in Linux successfully for years and would like to have
such input ability in windows.

Any ideas ?
Back to top
View user's profile Send private message Send e-mail
Lexikos



Joined: 17 Oct 2006
Posts: 2589
Location: Australia, Qld

PostPosted: Fri Jul 20, 2007 8:40 am    Post subject: Reply with quote

Use the Custom Combination feature. For example:
Code:
AppsKey & [::Send š
; some characters need to be escaped with `
AppsKey & `;::Send č
Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 904

PostPosted: Fri Jul 20, 2007 9:21 pm    Post subject: Reply with quote

But those aren't ascii characters, and unicode encoded .ahk files don't work, do they?
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6804
Location: Pacific Northwest, US

PostPosted: Fri Jul 20, 2007 10:01 pm    Post subject: Reply with quote

they can work - sometimes. I have a script for my wife for typing greek chars, that works. At a minimum, you can always use the clipboard and Transform it to unicode, then paste the result.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
daniel2
Guest





PostPosted: Fri Jul 20, 2007 10:13 pm    Post subject: Reply with quote

Code:
AppsKey & [::SendRaw š  ; <=works
AppsKey & ]::SendRaw đ  ; <=doesn't work
AppsKey & `;::SendRaw č  ; <=doesn't work
AppsKey & '::SendRaw ć  ; <=doesn't work
AppsKey & \::SendRaw ž  ; <=works

It looks like the clipboard may be the way to go!
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 2589
Location: Australia, Qld

PostPosted: Sat Jul 21, 2007 3:19 am    Post subject: Reply with quote

I'm not sure how special characters work. I think they are mapped into the ASCII range, depending on the codepage setting of the machine. (I didn't mention it because I assumed it would work on maxmax83's machine.) If not, I think you can use Send,{ASC nnnnn} to send Unicode characters, as described on the Send page. That, or Transform, Clipboard, Unicode, %MyUTF_String%.
Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 904

PostPosted: Sun Jul 22, 2007 8:49 pm    Post subject: Reply with quote

I finally figured out a good way to do this.

Code:
#SingleInstance Force
#NoEnv
SendMode Input

AppsKey::Send {AppsKey} ;preserve normal appsKey function

AppsKey & [::PutUni("c5a1") ;s with Caron
AppsKey & ]::PutUni("c491") ;d with Stroke
AppsKey & `;::PutUni("c48d") ;c with Caron
AppsKey & '::PutUni("c487") ;c with Acute
AppsKey & \::PutUni("c5be") ;z with Caron

;Paste hex string as unicode.
PutUni(HexIn)
{
   SavedClip := ClipBoardAll
   Loop % StrLen(HexIn) / 2
      TransCode .= Chr("0x" . SubStr(HexIn, A_Index * 2 - 1, 2))
   Transform, ClipBoard, Unicode, %TransCode%
   Send ^v
   Sleep 100 ;Generous, less wait or none will often work.
   ClipBoard := SavedClip
   return
}
Back to top
View user's profile Send private message
madmax83



Joined: 20 Jul 2007
Posts: 5

PostPosted: Sun Jul 22, 2007 9:50 pm    Post subject: found solution Reply with quote

Hi, thanks for suggestions and good pointers. I tried many methods but
after a lot of fiddling i found this great link:
http://www.autohotkey.com/forum/viewtopic.php?p=79708#79708

I used it and after hitting the wall (3 key custom combo) i found another
workaround for that on this forum. This is finished script that does all I need.
Thanks to everyone that helped!

Code:

DllCall("LoadLibrary", Str,"ntdll.dll")
VarSetCapacity( SendUbuf, 56, 0 )         ; INIT SendU data strucure
DllCall("RtlFillMemory", UInt,&SendUbuf,    UInt,1, UInt,1)
DllCall("RtlFillMemory", UInt,&SendUbuf+28, UInt,1, UInt,1)

AppsKey & [::
GetKeyState, State, SHIFT
if State = U
   SendU(0x0161)
else
   SendU(0x0160)
Return
AppsKey & ]::
GetKeyState, State, SHIFT
if State = U
   SendU(0x0111)
else
   SendU(0x0110)
Return
AppsKey & `;::
GetKeyState, State, SHIFT
if State = U
   SendU(0x010D)
else
   SendU(0x010C)
Return
AppsKey & '::
GetKeyState, State, SHIFT
if State = U
   SendU(0x0107)
else
   SendU(0x0106)
Return
AppsKey & \::
GetKeyState, State, SHIFT
if State = U
   SendU(0x017E)
else
   SendU(0x017D)
Return

SendU(UC) {    ; Send Char/Unicode, Pressed modifier keys stay active!
   Global      ; SendU(0x00E1) or SendU(33)
   DllCall("ntdll.dll\RtlFillMemoryUlong",UInt,&SendUbuf+6, UInt,4,UInt,0x40000|UC) ;KEYEVENTF_UNICODE
   DllCall("ntdll.dll\RtlFillMemoryUlong",UInt,&SendUbuf+34,UInt,4,UInt,0x60000|UC) ;KEYEVENTF_KEYUP|^
   Return DllCall("SendInput", UInt,2, UInt,&SendUbuf, Int,28)
}
[/quote]
Back to top
View user's profile Send private message Send e-mail
madmax83



Joined: 20 Jul 2007
Posts: 5

PostPosted: Tue Jul 24, 2007 9:27 pm    Post subject: Reply with quote

Unfortunately this does not work in putty. Any idea why ?
Back to top
View user's profile Send private message Send e-mail
Lexikos



Joined: 17 Oct 2006
Posts: 2589
Location: Australia, Qld

PostPosted: Wed Jul 25, 2007 12:12 am    Post subject: Reply with quote

No idea, but if putty accepts (unicode) Alt+Numpad sequences, you could use {Asc nnnnn}.
help: Send wrote:
Send, {ASC nnnnn}

Sends an ALT+nnnnn keypad combination, which can be used to generate special characters that don't exist on the keyboard. To generate ASCII characters, specify a number between 1 and 255. To generate ANSI characters (standard in most languages), specify a number between 128 and 255, but precede it with a leading zero, e.g. {Asc 0133}.

To generate Unicode characters, specify a number between 256 and 65535 (without a leading zero). However, this is not supported by all applications. Therefore, for greater compatibility and easier sending of long Unicode strings, use "Transform Unicode".
Back to top
View user's profile Send private message
madmax83



Joined: 20 Jul 2007
Posts: 5

PostPosted: Wed Jul 25, 2007 7:19 pm    Post subject: Reply with quote

No, could not make Send, {ASC nnnnn} work...

That dll hack works in almost everything I use except putty.

Using that hack I can type (in putty) šž characters but no čćđ (instead I get ccd).

If I change keyboard layout to Croatian I can get all letters šđčćž with
appskey, but then I must use Croatian layout which I would like to avoid
because it re-maps many other keys.

My goal is US keyboard layout with some latin2 characters accesible
using appskey combination.

pitty, if this worked for me in putty it would be perfect Sad

Any other free SSH client out there ?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
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