Ticket #1050: _install_syntax_files_textpad_5.au3

File _install_syntax_files_textpad_5.au3, 2.3 KB (added by poebel@…, 11 years ago)
Line 
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?")
14If $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)
20If Not FileExists($installdir) Then
21 $installdir = EnvGet("ProgramFiles(x86)") & "\TextPad 5\"
22ElseIf Not FileExists($installdir) Then
23 Error()
24EndIf
25
26If Not FileCopy("autoit_v3.syn", $installdir & "\system", 1) Then Error()
27If Not FileCopy("autoit_v3.tcl", $installdir & "\samples", 1) Then Error()
28
29; Now write the reg keys
30RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 5\Document Classes\AutoIt v3", "Type", "REG_DWORD", 2)
31RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 5\Document Classes\AutoIt v3", "Members", "REG_MULTI_SZ", "*.au3")
32RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 5\Document Classes\AutoIt v3", "Properties", "REG_BINARY", Binary("0x46000000010000000100000001000000"))
33RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 4\Document Classes\AutoIt v3", "SyntaxProps", "REG_BINARY", "01000000")
34RegWrite("HKEY_CURRENT_USER\Software\Helios\TextPad 5\Document Classes\AutoIt v3", "SyntaxFile", "REG_SZ", "autoit_v3.syn")
35RegWrite("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 ?")
38If $answer = 7 Then Exit
39RegWrite("HKEY_CLASSES_ROOT\AutoIt3Script\Shell\Edit\Command", "", "REG_SZ", '"' & $installdir & 'TextPad.exe" "%1"')
40
41; End of script
42
43
44Func Error()
45        MsgBox(4096, "Error", "Unable to find TextPad or error installing the syntax files.  Please try a manual installation.")
46        Exit
47EndFunc
48
49
50