| 1 | ; |
|---|
| 2 | ; AutoIt Version: 3.3 |
|---|
| 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 v5 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 v4/v5", "This script will attempt to automatically install syntax highlighting and clip library files for TextPad v4/v5. Run?") |
|---|
| 14 | If $answer = 7 Then Exit |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | ; Find and verify the installation directory |
|---|
| 18 | |
|---|
| 19 | ; Textpad v4 (x86) |
|---|
| 20 | If FileExists(@ProgramFilesDir & "\TextPad 4\") Then |
|---|
| 21 | $installdir = @ProgramFilesDir & "\TextPad 4\" |
|---|
| 22 | $textpad_version = "4" |
|---|
| 23 | |
|---|
| 24 | ; Textpad v4 (x64) |
|---|
| 25 | ElseIf FileExists(EnvGet("ProgramFiles(x86)") & "\TextPad 4\") Then |
|---|
| 26 | $installdir = EnvGet("ProgramFiles(x86)") & "\TextPad 4\" |
|---|
| 27 | $textpad_version = "5" |
|---|
| 28 | |
|---|
| 29 | ; Textpad v5 (x86) |
|---|
| 30 | ElseIf FileExists(@ProgramFilesDir & "\TextPad 5\") Then |
|---|
| 31 | $installdir = @ProgramFilesDir & "\TextPad 5\" |
|---|
| 32 | $textpad_version = "5" |
|---|
| 33 | |
|---|
| 34 | ; Textpad v5 (x64) |
|---|
| 35 | ElseIf FileExists(EnvGet("ProgramFiles(x86)") & "\TextPad 5\") Then |
|---|
| 36 | $installdir = EnvGet("ProgramFiles(x86)") & "\TextPad 5\" |
|---|
| 37 | $textpad_version = "5" |
|---|
| 38 | |
|---|
| 39 | ; Fail |
|---|
| 40 | Else |
|---|
| 41 | Error("Unable to find TextPad.") |
|---|
| 42 | EndIf |
|---|
| 43 | |
|---|
| 44 | If Not FileCopy("autoit_v3.syn", $installdir & "\system", 1) Then Error("Error installing the syntax files.") |
|---|
| 45 | If Not FileCopy("autoit_v3.tcl", $installdir & "\samples", 1) Then Error("Error installing the syntax files.") |
|---|
| 46 | |
|---|
| 47 | ; Now write the reg keys |
|---|
| 48 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad " & $textpad_version & "\Document Classes\AutoIt v3", "Type", "REG_DWORD", 2) |
|---|
| 49 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad " & $textpad_version & "\Document Classes\AutoIt v3", "Members", "REG_MULTI_SZ", "*.au3") |
|---|
| 50 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad " & $textpad_version & "\Document Classes\AutoIt v3", "Properties", "REG_BINARY", Binary("0x2a002e0061007500330000000000")) |
|---|
| 51 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad " & $textpad_version & "\Document Classes\AutoIt v3", "SyntaxProps", "REG_BINARY", Binary("0x01000000")) |
|---|
| 52 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad " & $textpad_version & "\Document Classes\AutoIt v3", "SyntaxFile", "REG_SZ", "autoit_v3.syn") |
|---|
| 53 | RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad " & $textpad_version & "\Document Classes\AutoIt v3", "WordChars", "REG_SZ", "_$") |
|---|
| 54 | |
|---|
| 55 | $answer = MsgBox(4096+4, "TextPad v4/v5", "Installation complete!" & @LF & @LF & "Do you want to make it the default editor for AutoItV3 scripts ?") |
|---|
| 56 | If $answer = 7 Then Exit |
|---|
| 57 | RegWrite("HKEY_CLASSES_ROOT\AutoIt3Script\Shell\Edit\Command", "", "REG_SZ", '"' & $installdir & 'TextPad.exe" "%1"') |
|---|
| 58 | |
|---|
| 59 | ; End of script |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | Func Error($error_msg) |
|---|
| 63 | MsgBox(4096, "Error", $error_msg & " Please try a manual installation.") |
|---|
| 64 | Exit |
|---|
| 65 | EndFunc |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|