Skip to content

Commit 68d7915

Browse files
Added build variant for compile with Aut2exe
1 parent fa35749 commit 68d7915

6 files changed

+39
-17
lines changed

AutoIt.sublime-build

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
22
"target": "autoitbuild",
3-
"selector": "source.autoit"
3+
"selector": "source.autoit",
4+
"variants": [
5+
{
6+
"name": "Run",
7+
"target": "autoitcompile",
8+
},
9+
]
10+
411
}

AutoIt.sublime-settings

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"AutoItExePath": "C:\\Program Files\\AutoIt3\\AutoIt3.exe",
3+
"AutoItCompilerPath": "C:\\Program Files\\AutoIt3\\Aut2Exe\\Aut2exe.exe",
34
"TidyExePath": "C:\\Program Files\\AutoIt3\\SciTE\\Tidy\\Tidy.exe"
45
}

Main.sublime-menu

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
"children":
77
[
88
{ "caption": "-", "id": "packagecommands" },
9-
{ "command": "autoittidy", "caption": "AutoIt Tidy"}
9+
{ "command": "autoittidy", "caption": "AutoIt Tidy", "mnemonic": "T"}
1010
]
1111
},
1212
{
1313
"caption": "Preferences",
14-
"mnemonic": "n",
1514
"id": "preferences",
1615
"children":
1716
[

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
AutoItScript - Syntax Package for Sublime Text 2/3
22
============
33

4-
AutoItScript AU3 language package for SublimeText including syntax highlighting, comments toggling, snippets, build system, and Tidy command.
5-
6-
For the build system and Tidy command, if you have a non-default installation you will need to set your specific path to AutoIt3.exe and Tidy.exe in a file named AutoIt.sublime-settings in your User folder. You can open the settings files via the Menu Preferences>Package Settings>AutoIt. You should make a copy of "AutoIt Settings - Default" at "AutoIt Settings - User" since then your settings file in your User folder will not get overwritten when this package updates.
4+
AutoItScript AU3 language package for SublimeText including syntax highlighting, comments toggling, snippets, build systems for run and compile, and Tidy command.
75

6+
For the build systems and Tidy command, if you have a non-default installation you will need to set your specific path to AutoIt3.exe, Aut2Exe.exe, and Tidy.exe in a file named AutoIt.sublime-settings in your User folder. You can access these settings file from the Menu Preferences>Package Settings>AutoIt. You should make a copy of "AutoIt Settings - Default" at "AutoIt Settings - User" since then your settings file in your User folder will not get overwritten when this package updates.
87

98
Credits
109
------------

autoitbuild.py

+25-9
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,36 @@ def run(self):
1111
cmd = [AutoItExePath, "/ErrorStdOut", filepath]
1212
self.window.run_command("exec", {"cmd": cmd})
1313

14+
class autoitcompile(sublime_plugin.WindowCommand):
15+
16+
def run(self):
17+
filepath = self.window.active_view().file_name()
18+
AutoItCompilerPath = sublime.load_settings("AutoIt.sublime-settings").get("AutoItCompilerPath")
19+
cmd = [AutoItCompilerPath, "/in", filepath]
20+
self.window.run_command("exec", {"cmd": cmd})
21+
1422
class autoittidy(sublime_plugin.WindowCommand):
1523

1624
def run(self):
1725
self.window.run_command("save")
1826
filepath = self.window.active_view().file_name()
1927
TidyExePath = sublime.load_settings("AutoIt.sublime-settings").get("TidyExePath")
2028
tidycmd = [TidyExePath, filepath]
21-
tidyprocess = subprocess.Popen(tidycmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
22-
tidyoutput = tidyprocess.communicate()[0].rstrip()
23-
self.window.run_command("revert")
24-
print("------------ Beginning AutoIt Tidy ------------")
25-
print(tidyoutput)
26-
if("Tidy Error" in tidyoutput):
29+
try:
30+
tidyprocess = subprocess.Popen(tidycmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
31+
tidyoutput = tidyprocess.communicate()[0].rstrip()
32+
tidyoutputskipfirstline = "".join(tidyoutput.splitlines(True)[1:])
33+
self.window.run_command("revert")
34+
print("------------ Beginning AutoIt Tidy ------------")
35+
print(tidyoutput)
36+
if("Tidy Error" in tidyoutput):
37+
sublime.active_window().run_command("show_panel", {"panel": "console"})
38+
sublime.status_message("### Tidy Errors : Please See Console")
39+
else:
40+
sublime.status_message(tidyoutputskipfirstline)
41+
except Exception as e:
2742
sublime.active_window().run_command("show_panel", {"panel": "console"})
28-
sublime.status_message("### Tidy Errors : Please See Console")
29-
else:
30-
sublime.status_message(tidyoutput)
43+
print("------------ ERROR: Python exception trying to run Tidy ------------")
44+
print("TidyCmd was: " + " ".join(tidycmd))
45+
print("Error {0}".format(str(e)))
46+
sublime.status_message("### EXCEPTION: " + str(e))

packages.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"platforms": {
1111
"windows": [
1212
{
13-
"version": "1.2.6",
14-
"url": "https://nodeload.github.com/robertcollier4/AutoItScript/zip/1.2.6"
13+
"version": "1.2.7",
14+
"url": "https://nodeload.github.com/robertcollier4/AutoItScript/zip/1.2.7"
1515
}
1616
]
1717
}

0 commit comments

Comments
 (0)