| 1 | ; |
|---|
| 2 | ; AutoIt Version: 3.0 |
|---|
| 3 | ; Language: English |
|---|
| 4 | ; Platform: Win9x/NT |
|---|
| 5 | ; Author: Jonathan Bennett <jon at hiddensoft com> |
|---|
| 6 | ; Author: edited (20090701) by poebel <poebel at poebel net> for TextPad 5 and x64 systems (use EnvGet("ProgramFiles(x86)") instead of @ProgramFilesDir |
|---|
| 7 | ; |
|---|
| 8 | ; Script Function: |
|---|
| 9 | ; Syntax highlighting files installation. |
|---|
| 10 | ; |
|---|
| 11 | |
|---|
| 12 | ; Prompt the user to run the script - use a Yes/No prompt (4 - see help file) |
|---|
| 13 | $answer = MsgBox(4, "TextPad v5", "This script will attempt to automatically install syntax highlighting and clip library files for TextPad v5. Run?") |
|---|
| 14 | If $answer = 7 Then Exit |
|---|
| 15 | |
|---|
| 16 | ; Find an verify the installation directory |
|---|
| 17 | $installdir = @ProgramFilesDir & "\TextPad 5\" |
|---|
| 18 | |
|---|
| 19 | ; Check that the directory exists (and retry with EnvGet("ProgramFiles(x86) if not) |
|---|
| 20 | If Not FileExists($installdir) Then |
|---|
| 21 | $installdir = EnvGet("ProgramFiles(x86)") & "\TextPad 5\" |
|---|
| 22 | ElseIf Not FileExists($installdir) Then |
|---|
| 23 | Error() |
|---|
| 24 | EndIf |
|---|
| 25 | |
|---|
| 26 | If Not FileCopy("autoit_v3.syn", $installdir & "\system", 1) Then Error() |
|---|
| 27 | If Not FileCopy("autoit_v3.tcl", $installdir & "\samples", 1) Then Error() |
|---|
| 28 | |
|---|
| 29 | ; Now write the reg keys |
|---|
| 30 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 5\Document Classes\AutoIt v3", "Type", "REG_DWORD", 2) |
|---|
| 31 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 5\Document Classes\AutoIt v3", "Members", "REG_MULTI_SZ", "*.au3") |
|---|
| 32 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 5\Document Classes\AutoIt v3", "Properties", "REG_BINARY", Binary("0x46000000010000000100000001000000")) |
|---|
| 33 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 4\Document Classes\AutoIt v3", "SyntaxProps", "REG_BINARY", "01000000") |
|---|
| 34 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 5\Document Classes\AutoIt v3", "SyntaxFile", "REG_SZ", "autoit_v3.syn") |
|---|
| 35 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 5\Document Classes\AutoIt v3", "WordChars", "REG_SZ", "_$") |
|---|
| 36 | |
|---|
| 37 | $answer = MsgBox(4096+4, "TextPad v5", "Installation complete!" & @LF & @LF & "Do you want to make it the default editor for AutoItV3 scripts ?") |
|---|
| 38 | If $answer = 7 Then Exit |
|---|
| 39 | RegWrite("HKEY_CLASSES_ROOT\AutoIt3Script\Shell\Edit\Command", "", "REG_SZ", '"' & $installdir & 'TextPad.exe" "%1"') |
|---|
| 40 | |
|---|
| 41 | ; End of script |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | Func Error() |
|---|
| 45 | MsgBox(4096, "Error", "Unable to find TextPad or error installing the syntax files. Please try a manual installation.") |
|---|
| 46 | Exit |
|---|
| 47 | EndFunc |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|