AutoHotkey Community

It is currently May 25th, 2012, 12:58 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: July 20th, 2007, 1:56 am 
Offline

Joined: July 20th, 2007, 1:39 am
Posts: 5
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 ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2007, 8:40 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
Use the Custom Combination feature. For example:
Code:
AppsKey & [::Send š
; some characters need to be escaped with `
AppsKey & `;::Send č


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2007, 9:21 pm 
Offline

Joined: May 24th, 2007, 3:45 am
Posts: 1121
But those aren't ascii characters, and unicode encoded .ahk files don't work, do they?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2007, 10:01 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8647
Location: Salem, MA
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.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2007, 10:13 pm 
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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 21st, 2007, 3:19 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
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%.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 22nd, 2007, 8:49 pm 
Offline

Joined: May 24th, 2007, 3:45 am
Posts: 1121
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject: found solution
PostPosted: July 22nd, 2007, 9:50 pm 
Offline

Joined: July 20th, 2007, 1:39 am
Posts: 5
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/viewtop ... 9708#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]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2007, 9:27 pm 
Offline

Joined: July 20th, 2007, 1:39 am
Posts: 5
Unfortunately this does not work in putty. Any idea why ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2007, 12:12 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
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".


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2007, 7:19 pm 
Offline

Joined: July 20th, 2007, 1:39 am
Posts: 5
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 :(

Any other free SSH client out there ?


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: mc-lemons, netaware and 13 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