summaryrefslogtreecommitdiff
path: root/windows/neo-vars/src/source/initialize.ahk
blob: a9fec082d17dd0358b11d92b26f665855fd994a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
if (A_IsCompiled) {
; Revisionsinformation bereits verfügbar
} else {
; Revisionsinformation nicht verfügbar oder nicht zuverlässig, neu generieren
  if (FileExist(".svn")<>False) {
    ; .svn existiert, scheint also ausgecheckt worden zu sein
    RegRead,TSVNPath,HKLM,SOFTWARE\TortoiseSVN,Directory
    RegRead,SVNPath,HKLM,SOFTWARE\CollabNet\Subversion\1.5.4\Client,Install Location
    if (TSVNPath<>"") {
      ; fein, TSVN ist installiert!
      RunWait, "%TSVNPath%bin\SubWCRev.exe" "." "Source\_subwcrev1.tmpl.ahk" "Source\_subwcrev1.generated.ahk",,Hide
      FileRead,TSVNRevFull,Source\_subwcrev1.generated.ahk
      RegExMatch(TSVNRevFull,"""(.*)""",SubPat)
      Revision := SubPat1
    } else if (SVNPath<>"") {
      ; fein, CollabNet-SVN-Client ist installiert!
      RunWait, %comspec% /c ""%SVNPath%\svnversion.exe" "." >"Source\_svnversion.generated.txt"",,Hide
      FileRead,SVNRevFull,Source\_svnversion.generated.txt
      RegExMatch(SVNRevFull,"(.*)$",SubPat)
      Revision := SubPat1
    } else {
      ; nichts installiert. Was jetzt?
      Revision := "<unknown>"
    }
  } else {
    ; kein .svn-Verzeichnis. Was jetzt?
    Revision := "<unknown>"
  }
}

name=Neo 2.0 r%Revision%-r%CompRevision% (%A_ScriptName%)
enable=Aktiviere %name%
disable=Deaktiviere %name%
#LTrim ; Quelltext kann eingerückt werden

SetCapsLockState Off
SetScrollLockState Off
SetNEONumLockState()
OnExit, exitprogram

EnvGet, WindowsEnvAppDataFolder, APPDATA
if (WindowsEnvAppDataFolder == "") {
  EnvGet, WindowsEnvAppDataFolder, USERPROFILE
  WindowsEnvAppDataFolder .= "\Anwendungsdaten"
}
ApplicationFolder = %WindowsEnvAppDataFolder%\NEO2
FileCreateDir, %ApplicationFolder%
ini = %ApplicationFolder%\NEO2.ini

IniRead,zeigeLockBox,%ini%,Global,zeigeLockBox,1
IniRead,zeigeModusBox,%ini%,Global,zeigeModusBox,1
IniRead,UseMod4Light,%ini%,Global,UseMod4Light,1
IniRead,striktesMod2Lock,%ini%,Global,striktesMod2Lock,0
IniRead,dynamischesCompose,%ini%,Global,dynamischesCompose,0

regread,inputlocale,HKEY_CURRENT_USER,Keyboard Layout\Preload,1
regread,inputlocalealias,HKEY_CURRENT_USER,Keyboard Layout\Substitutes,%inputlocale%

if (inputlocalealias<>"")
  inputlocale:=inputlocalealias

if (inputlocale<>"00000407" and inputlocale<>"00000807" and inputlocale<>"00010407") {
  suspend   
  regread,inputlocale,HKEY_LOCAL_MACHINE,SYSTEM\CurrentControlSet\Control\Keyboard Layouts\%inputlocale%,Layout Text
  msgbox, 48, Warnung!,
    (
    Nicht kompatibles Tastaturlayout:   
    `t%inputlocale%   
    `nDas deutsche QWERTZ muss als Standardlayout eingestellt  
    sein, damit %name% wie erwartet funktioniert.   
    `nÄndern Sie die Tastatureinstellung unter 
    `tSystemsteuerung   
    `t-> Regions- und Sprachoptionen   
    `t-> Sprachen 
    `t-> Details...   `n
    )
  exitapp
}

wasNonShiftKeyPressed := 0
isShiftRPressed := 0
isShiftLPressed := 0
isShiftPressed := 0
isMod2Locked := 0
IsMod3RPressed := 0
IsMod3LPressed := 0
IsMod3Pressed := 0
IsMod4RPressed := 0
IsMod4LPressed := 0
IsMod4Pressed := 0
IsMod4Locked := 0
EbeneAktualisieren := "NEOEbeneAktualisieren"

SaveNumLockState() {
  global
  if GetKeyState("NumLock","T")
    SavedNumLockState:="On"
  else
    SavedNumLockState:="Off"
}

SetNEONumLockState() {
  global
  SaveNumLockState()
  if (SavedNumLockState == "Off") {
    SetNumLockState, On
    Sleep, 1           ; damit sich das Aktivieren von NumLock nicht mit dem Deaktivieren der LED prügeln muss
  }
  KeyboardLED(2,"off") ; deaktivieren, falls sie doch brennt
}

SetOldNumLockState() {
  global
  if (SavedNumLockState == "On")
    KeyboardLED(2,"on")
  else
    SetNumLockState, Off
}

%EbeneAktualisieren%()

ActivateLayOut(inputlocale)

TheKeys()

if (dynamischesCompose)
  LoadCurrentCompose()
else
  LoadDefaultCompose()