1
votes

I am trying to make shortcut using autohotkey where typing "println" produces "System.out.println();" but typing ".println" produces ".println();". The purpose of this is to help me with something I commonly type when I'm writing code for my java course. I want use the regular keyboard dot to be not the numpad dot for this shortcut but I do not care about which dot is used in the output.

I have tried the following:

;for Java println
::println::
SendInput System.out.println();{Left}{Left}
return


;block change if '.println'
::.println::
SendInput {NumpadDot}println();{Left}{Left}
return

However, this only does the first shortcut and not the second. Can you help me get this script to work?

1

1 Answers

0
votes

Declare ::.println:: before ::println:: and your idea will work.

::. println::  ; you might wan't to add this in case you add a space after a ,
SendInput {NumpadDot}println();{Left}{Left}
return

::.println::
SendInput {NumpadDot}println();{Left}{Left}
return


::println::
SendInput System.out.println();{Left}{Left}
return