Difference between revisions of "SciTE4AutoIt3"

From AutoIt Wiki
Jump to navigation Jump to search
m (Link didn't work)
m (Cleaned up double spaces and minor typos)
Line 2: Line 2:
 
SciTE4AutoIt3 is a specialist editor package based around the excellent [http://www.scintilla.org/SciTE.html SciTE] editor.  The editor has been set up to compile AutoIt scripts.  SciTE has been extended with a multitude of lua scripts.  SciTE4AutoIt3 may be downloaded here: [http://www.autoitscript.com/site/autoit-script-editor/ SciTE4AutoIt3]
 
SciTE4AutoIt3 is a specialist editor package based around the excellent [http://www.scintilla.org/SciTE.html SciTE] editor.  The editor has been set up to compile AutoIt scripts.  SciTE has been extended with a multitude of lua scripts.  SciTE4AutoIt3 may be downloaded here: [http://www.autoitscript.com/site/autoit-script-editor/ SciTE4AutoIt3]
  
SciTE4AutoIt3 comes with an array of tools and advanced options including a configuration program named "SciTE Config" under the "tools" menu.  With ''SciTE Config'' a user may change the color scheme of SciTE's syntax highlighting, change the default Au3 script file double-click action, create a script backup policy and determine what tools are shown in SciTE's tools menu.  Also available are calltips, abbreviations, and quick access to the helpfiles.
+
SciTE4AutoIt3 comes with an array of tools and advanced options including a configuration program named "SciTEConfig" under the "Tools" menu.  With ''SciTEConfig'' a user may change the color scheme of SciTE's syntax highlighting, change the default au3 script file double-click action, create a script backup policy and determine what tools are shown in SciTE's Tools menu.  Also available are calltips, abbreviations, and quick access to the helpfile.
  
 +
Keep in mind that SciTE4AutoIt3 is not an official package.  Direct any bug reports or feature requests to the AutoIt3 forum and not the bug tracker.
  
==SciTE Quick Tips==
+
==Quick Tips==
 
 
 
To access the helpfile the user may press [Alt] + [F1].  
 
To access the helpfile the user may press [Alt] + [F1].  
 
To quickly access help information on a specific function/statement, simply click/highlight the function/statement in question and press the [F1] key to bring up the help file on a relevant page.
 
To quickly access help information on a specific function/statement, simply click/highlight the function/statement in question and press the [F1] key to bring up the help file on a relevant page.
  
For SciTE related help, use the key combination [Ctrl] + [F1] to bring up a help file detailing SciTE related help documentation. ''It's recommended you read it.''
+
For SciTE related help, use the key combination [Ctrl] + [F1] to bring up a help file detailing SciTE related help documentation. ''It's recommended that you read it.''
  
 
For anyone not familiar with SciTE, here are a few tips and tricks to help you easily modify the installation to suit your needs. For any "truly" advanced info, you should visit the [[http://www.scintilla.org/SciTEDoc.html SciTE home page]].
 
For anyone not familiar with SciTE, here are a few tips and tricks to help you easily modify the installation to suit your needs. For any "truly" advanced info, you should visit the [[http://www.scintilla.org/SciTEDoc.html SciTE home page]].
  
With the information below, you will be doing some minor editing to SciTEs configuration files.
+
With the information below, you will be doing some minor editing to SciTE's configuration files.
It is imperative that you know the hierarchy of SciTEs configuration files. The main files we will be dealing with here are listed below.
+
It is imperative that you know the hierarchy of SciTE's configuration files. The main files we will be dealing with here are listed below.
  
 
Remember there are four properties files used:
 
Remember there are four properties files used:
Line 23: Line 23:
 
# ''SciTEUser.properties''
 
# ''SciTEUser.properties''
 
# ''SciTEGlobal.properties''
 
# ''SciTEGlobal.properties''
 
  
 
<table border="1">
 
<table border="1">
Line 32: Line 31:
 
</table>
 
</table>
  
''If you're having any trouble finding any of the previously mentioned files, I recommend you NOT continue with this information...''
+
''If you have any trouble finding any of the previously mentioned files then I recommend that you do ''not'' continue further.''
 
 
  
 
===Inline Errors===
 
===Inline Errors===
Line 39: Line 37:
 
In the latest version of SciTE, there exists a new feature called "Inline Errors", some users find them annoying. Inline Error marks are error messages that will appear in the source code within the Scintilla window. While helpful, some users prefer to disable this feature often for unknown reasons.
 
In the latest version of SciTE, there exists a new feature called "Inline Errors", some users find them annoying. Inline Error marks are error messages that will appear in the source code within the Scintilla window. While helpful, some users prefer to disable this feature often for unknown reasons.
 
You can quickly disable/enable them using the '''SciTEUser.properties'''.
 
You can quickly disable/enable them using the '''SciTEUser.properties'''.
 
  
 
Open the SciTE user properties file in a text editor and add the following code to the file.
 
Open the SciTE user properties file in a text editor and add the following code to the file.
Line 49: Line 46:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
To enable Inline Errors, add the following.
 
To enable Inline Errors, add the following.
 
 
<syntaxhighlight lang="properties">
 
<syntaxhighlight lang="properties">
 
# Display settings for inline errors on the source
 
# Display settings for inline errors on the source
Line 56: Line 52:
  
 
===Selection Highlighting===
 
===Selection Highlighting===
In the latest SciTEforAutoIt3, there is a new feature which highlights other instances of the highlighted word or string. Due to the colors, sometimes it's hard to tell the selection apart.
+
In the latest SciTE4AutoIt3, there is a new feature which highlights other instances of the currently highlighted word or string. Due to the colors, sometimes it's hard to tell the selection apart.
  
 
If you'd like, you can do either of two things using the ''SciTEUser.properties''.
 
If you'd like, you can do either of two things using the ''SciTEUser.properties''.
Line 68: Line 64:
 
To re-enable it, just delete it and save.
 
To re-enable it, just delete it and save.
  
To change the color scheme, add the following to your SciTEUser properties file.
+
To change the color scheme, add the following to your SciTEUser.properties file.
 
<syntaxhighlight lang="properties">
 
<syntaxhighlight lang="properties">
 
highlight.current.word.colour=#000040
 
highlight.current.word.colour=#000040
Line 75: Line 71:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Try adjusting the ''#COLOR'' values to get an effect you'd prefer.
+
The user should try adjusting the ''#COLOR'' values to come to a preferred color.
  
 
===More Language Highlighting Options===
 
===More Language Highlighting Options===
 
 
In the SciTEUser.properties file, add the following code.
 
In the SciTEUser.properties file, add the following code.
 
  
 
<syntaxhighlight lang="properties">
 
<syntaxhighlight lang="properties">
Line 158: Line 152:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
For whatever language you wish to have an option appear under the ''Language'' menu option, uncomment the language.
+
For whatever language you wish to have an option appear under the ''Language'' menu option, uncomment the language. Say you want to SciTE to give you the option to highlight batch script code, change the following string in the above list from
 
 
Say you want to SciTE to give you the option to highlight batch script code, change the following string in the above list from
 
  
 
<syntaxhighlight lang="properties">
 
<syntaxhighlight lang="properties">
Line 169: Line 161:
 
&Batch|bat||\
 
&Batch|bat||\
 
</syntaxhighlight>
 
</syntaxhighlight>
Restart SciTE and if done correctly, the option should be present!
+
Restart SciTE and if done correctly, the option should be present! Do this for any language listed in the above example list.
Do this for any language listed in the above example list.
 
  
 
In the case that you uncommented a language and you notice that it's not being highlighted correctly, then we will have to edit some things in the '''SciTEGlobal.properties''' file.
 
In the case that you uncommented a language and you notice that it's not being highlighted correctly, then we will have to edit some things in the '''SciTEGlobal.properties''' file.
  
 
Open the '''SciTEGlobal.properties''' file in a text editor and find the section
 
Open the '''SciTEGlobal.properties''' file in a text editor and find the section
 
 
<syntaxhighlight lang="properties">
 
<syntaxhighlight lang="properties">
 
# import properties\all the language specific properties files
 
# import properties\all the language specific properties files
Line 182: Line 172:
 
<syntaxhighlight lang="properties">
 
<syntaxhighlight lang="properties">
 
#import properties\[syntax]
 
#import properties\[syntax]
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 
Uncomment the syntax related property you wish to have support for.
 
Uncomment the syntax related property you wish to have support for.
Line 196: Line 185:
 
  #AutoIt3Wrapper_Run_Obfuscator=y
 
  #AutoIt3Wrapper_Run_Obfuscator=y
 
  #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
 
  #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
 
  
 
On a medium sized script, results are often like this:
 
On a medium sized script, results are often like this:
Line 209: Line 197:
 
  +> Saved    93% lines 94% Characters.
 
  +> Saved    93% lines 94% Characters.
 
  +> Obfuscator v1.0.27.0 finished obfuscating 1566 lines, created:C:\MyScript_Obfuscated.au3
 
  +> Obfuscator v1.0.27.0 finished obfuscating 1566 lines, created:C:\MyScript_Obfuscated.au3
 
  
 
==Using ResHacker==
 
==Using ResHacker==
Line 216: Line 203:
 
  #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, MyPicture.bmp, BITMAP, RESOURCENAME, 0
 
  #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, MyPicture.bmp, BITMAP, RESOURCENAME, 0
  
 
+
*NB:* Reshacker.exe ''must'' be copied into the script directory for this to work!
*NB:* Reshacker.exe MUST be copied into the script directory for this to work!
 
  
 
If you then want to use the resources in your code, there is an excellent [http://www.autoitscript.com/forum/index.php?showtopic=51103 Resources UDF] which will allow you to access the resources from within the exe.
 
If you then want to use the resources in your code, there is an excellent [http://www.autoitscript.com/forum/index.php?showtopic=51103 Resources UDF] which will allow you to access the resources from within the exe.
Line 230: Line 216:
 
  #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, %scriptfile%.au3, RCDATA, SOURCE, 0
 
  #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, %scriptfile%.au3, RCDATA, SOURCE, 0
  
==Creating a Version directory==
+
==Creating a Version Directory==
 
When compiling, it is very possible that you want to go back to a previous version. If so, then it is neat to have a directory which will store all previous builds, without the need for you to manually copy and paste every time! Make sure you add these directives in last (after adding resources) as they might not be included in the copied result.
 
When compiling, it is very possible that you want to go back to a previous version. If so, then it is neat to have a directory which will store all previous builds, without the need for you to manually copy and paste every time! Make sure you add these directives in last (after adding resources) as they might not be included in the copied result.
  
Line 236: Line 222:
 
  #AutoIt3Wrapper_Run_After=copy "%in%" "%scriptdir%\Versions\%fileversion%\%scriptfile%%fileversion%.au3"
 
  #AutoIt3Wrapper_Run_After=copy "%in%" "%scriptdir%\Versions\%fileversion%\%scriptfile%%fileversion%.au3"
 
  #AutoIt3Wrapper_Run_After=copy "%out%" "%scriptdir%\Versions\%fileversion%\%scriptfile%%fileversion%.exe"
 
  #AutoIt3Wrapper_Run_After=copy "%out%" "%scriptdir%\Versions\%fileversion%\%scriptfile%%fileversion%.exe"
 
  
 
==Running the exe on build==
 
==Running the exe on build==
Often you are building as a test, so to have to open up explorer to get the exe is a pain, furthermore, unless you have a program to do it (or its a console program) you will not be able to read console info such as the debug messages you put in the exe. The solution is simple:
+
Often you are building as a test, so to have to open up Windows Explorer to get the exe is a pain, furthermore, unless you have a program to do it (or it's a console program) you will not be able to read console info such as the debug messages you put in the exe. The solution is simple:
  
 
  #AutoIt3Wrapper_Run_After="%out%"
 
  #AutoIt3Wrapper_Run_After="%out%"
Line 250: Line 235:
 
  #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, MyPicture.bmp, BITMAP, RESOURCENAME, 0
 
  #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, MyPicture.bmp, BITMAP, RESOURCENAME, 0
 
  #AutoIt3Wrapper_Run_After=TYPE ResHacker.log
 
  #AutoIt3Wrapper_Run_After=TYPE ResHacker.log
 
  
 
The new output now looks like this:
 
The new output now looks like this:
Line 263: Line 247:
 
  Commands completed
 
  Commands completed
 
  >TYPE ResHacker.log Ended  rc:0
 
  >TYPE ResHacker.log Ended  rc:0
 
  
 
And an example of it showing an error:
 
And an example of it showing an error:

Revision as of 11:39, 11 November 2012

SciTE4AutoIt3

SciTE4AutoIt3 is a specialist editor package based around the excellent SciTE editor. The editor has been set up to compile AutoIt scripts. SciTE has been extended with a multitude of lua scripts. SciTE4AutoIt3 may be downloaded here: SciTE4AutoIt3

SciTE4AutoIt3 comes with an array of tools and advanced options including a configuration program named "SciTEConfig" under the "Tools" menu. With SciTEConfig a user may change the color scheme of SciTE's syntax highlighting, change the default au3 script file double-click action, create a script backup policy and determine what tools are shown in SciTE's Tools menu. Also available are calltips, abbreviations, and quick access to the helpfile.

Keep in mind that SciTE4AutoIt3 is not an official package. Direct any bug reports or feature requests to the AutoIt3 forum and not the bug tracker.

Quick Tips

To access the helpfile the user may press [Alt] + [F1]. To quickly access help information on a specific function/statement, simply click/highlight the function/statement in question and press the [F1] key to bring up the help file on a relevant page.

For SciTE related help, use the key combination [Ctrl] + [F1] to bring up a help file detailing SciTE related help documentation. It's recommended that you read it.

For anyone not familiar with SciTE, here are a few tips and tricks to help you easily modify the installation to suit your needs. For any "truly" advanced info, you should visit the [SciTE home page].

With the information below, you will be doing some minor editing to SciTE's configuration files. It is imperative that you know the hierarchy of SciTE's configuration files. The main files we will be dealing with here are listed below.

Remember there are four properties files used:

  1. SciTE.properties
  2. SciTEDirectory.properties
  3. SciTEUser.properties
  4. SciTEGlobal.properties
SciTE.propertiesLocal properties file which may be present in the same directory as the file being edited. This file overrides any other properties files settings below. This file is user created.
SciTEDirectory.propertiesDirectory properties file which may be present in the same or in a parent directory as the file being edited. This file overrides all properties setting of the files below, but not the local properties settings aka SciTE.properties. This file is user created.
SciTEUser.propertiesUser properties file, this files settings override only the Global properties settings aka SciTEGlobal.properties. This file is found under the current logged on users profile directory.
SciTEGlobal.propertiesAll settings in this file can be overridden by any of the above files. Typically you shouldn't mess with this file and use any of the above methods to implement a setting change. This file can be found in SciTE's installation directory.

If you have any trouble finding any of the previously mentioned files then I recommend that you do not continue further.

Inline Errors

Intentional error prone code used to display the "Inline Error" feature.

In the latest version of SciTE, there exists a new feature called "Inline Errors", some users find them annoying. Inline Error marks are error messages that will appear in the source code within the Scintilla window. While helpful, some users prefer to disable this feature often for unknown reasons. You can quickly disable/enable them using the SciTEUser.properties.

Open the SciTE user properties file in a text editor and add the following code to the file.

To disable Inline Errors, add the following.

# Display settings for inline errors on the source
error.inline=0

To enable Inline Errors, add the following.

# Display settings for inline errors on the source
error.inline=1

Selection Highlighting

In the latest SciTE4AutoIt3, there is a new feature which highlights other instances of the currently highlighted word or string. Due to the colors, sometimes it's hard to tell the selection apart.

If you'd like, you can do either of two things using the SciTEUser.properties.

  1. Disable it
  2. Change the color scheme

To disable it

highlight.current.word=0

To re-enable it, just delete it and save.

To change the color scheme, add the following to your SciTEUser.properties file.

highlight.current.word.colour=#000040
selection.alpha=50
selection.back=#F025A8

The user should try adjusting the #COLOR values to come to a preferred color.

More Language Highlighting Options

In the SciTEUser.properties file, add the following code.

# Language Highlighting Options
menu.language=\
#FreeBasic|bas||\
Text|txt|Shift+F11|\
#Ada|ads||\
AutoIt3|au3|Shift+F12|\
#Apache Confi&g|conf||\
#Assembler|asm||\
#ASN.1|asn1||\
#Avenue|ave||\
#Baan|bc||\
#&Batch|bat||\
#Bullant|ant||\
#&C / C++|cpp||\
#CMake|cmake||\
#C&#|cs||\
#COBOL|cob||\
#Csound|orc||\
#CSS|css||\
#D|d||\
#&Difference|diff||\
#&Eiffel|e||\
#Erlang|erl||\
#&Errorlist|err||\
#FlagShip|prg||\
#&Fortran|f90||\
#&Fortran|f90||\
#Gap|g||\
#Haskell|hs||\
#H&ypertext|html|$(keyHTML)|\
#&InnoSetup|iss||\
#&Java|java||\
#Java&Script|js||\
#&Kix|kix||\
#Lisp|lisp||\
#Lot|lot||\
#Lout|lt||\
#Lu&a|lua||\
#Matlab|m.matlab||\
#&Makefile|mak||\
#MetaPost|mp||\
#MMIXAL|mms||\
#Modula-3|m3||\
#&nnCron crontab|tab||\
#NSIS|nsis||\
#Objective Caml|ml||\
#Octave|m.octave||\
#Opal|impl||\
#Pascal|pas||\
#Pe&rl|pl||\
#P&HP|php||\
#P&LSQL|spec||\
#P&ostScript|ps||\
#P&OV-Ray SDL|pov||\
#PowerShell|ps1||\
#PowerPro|powerpro||\
#&Properties|properties||\
#Pytho&n|py||\
#R|R||\
#Reso&urce|rc||\
#Ruby|rb||\
#Shell|sh||\
#S&QL|sql||\
#Specman|e||\
#&TCL|tcl||\
#TeX|tex||\
#&txt2tags|t2t||\
#&VB|vb||\
#VBScr&ipt|vbs||\
#Verilog|v||\
#VHDL|vhd||\
#&XML|xml||\
#&YAML|yaml||

For whatever language you wish to have an option appear under the Language menu option, uncomment the language. Say you want to SciTE to give you the option to highlight batch script code, change the following string in the above list from

#&Batch|bat||\

to

&Batch|bat||\

Restart SciTE and if done correctly, the option should be present! Do this for any language listed in the above example list.

In the case that you uncommented a language and you notice that it's not being highlighted correctly, then we will have to edit some things in the SciTEGlobal.properties file.

Open the SciTEGlobal.properties file in a text editor and find the section

# import properties\all the language specific properties files

Below that section there will be a few strings that look like

#import properties\[syntax]

Uncomment the syntax related property you wish to have support for.

Say you wanted support for ruby, just locate the one that says ruby where [syntax] is written.

AutoIt3Wrapper

AutoIt3Wrapper directives allow much greater and in depth control of your resulting programs. Some of these can be very useful under different circumstances.

Stripping excess code

For instance, if you have several includes, then you can often strip thousands of lines from your program using obfuscator:

#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0

On a medium sized script, results are often like this:

>Running Obfuscator (1.0.27.0)  from:C:\Program Files\AutoIt3\SciTE cmdline:
- Iteration 1 Strip Functions result: Output  2580 lines and stripped 6741 lines
- Iteration 2 Strip Variables result: Output  1585 lines and stripped 950 lines
- Iteration 3 Strip Variables result: Output  1566 lines and stripped 19 lines
- Iteration 4 Start the actual Obfuscation.
+> Source    26190 lines 1447980 Characters.
+> Stripped  7710 Func/Var lines and  16862 comment lines, Total 1373871 Characters.
+> Saved     93% lines 94% Characters.
+> Obfuscator v1.0.27.0 finished obfuscating 1566 lines, created:C:\MyScript_Obfuscated.au3

Using ResHacker

ResHacker is a very important programming tool for extracting and adding resources into executables. It has a very simple command line interface that allows it to be used easily using the "Run_After" directive. Adding a picture to an executable could be done like this:

#AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, MyPicture.bmp, BITMAP, RESOURCENAME, 0
  • NB:* Reshacker.exe must be copied into the script directory for this to work!

If you then want to use the resources in your code, there is an excellent Resources UDF which will allow you to access the resources from within the exe.

Adding original source code

When using the above tip on stripping excess code, the new source is not readable. As a result, using the standard directive for saving the source:

#AutoIt3Wrapper_Res_SaveSource=y

Would add the obfuscated code to the exe, which is not the desired result. The solution is to add it in manually. This code does not require any editing, so you can just copy and paste it in:

#AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, %scriptfile%.au3, RCDATA, SOURCE, 0

Creating a Version Directory

When compiling, it is very possible that you want to go back to a previous version. If so, then it is neat to have a directory which will store all previous builds, without the need for you to manually copy and paste every time! Make sure you add these directives in last (after adding resources) as they might not be included in the copied result.

#AutoIt3Wrapper_Run_After=md "%scriptdir%\Versions\%fileversion%"
#AutoIt3Wrapper_Run_After=copy "%in%" "%scriptdir%\Versions\%fileversion%\%scriptfile%%fileversion%.au3"
#AutoIt3Wrapper_Run_After=copy "%out%" "%scriptdir%\Versions\%fileversion%\%scriptfile%%fileversion%.exe"

Running the exe on build

Often you are building as a test, so to have to open up Windows Explorer to get the exe is a pain, furthermore, unless you have a program to do it (or it's a console program) you will not be able to read console info such as the debug messages you put in the exe. The solution is simple:

#AutoIt3Wrapper_Run_After="%out%"

This will run the program and read the console output to the SciTE debug frame.

Extended Reshacker Info

ResHacker doesn't always return with a return code (rc) of not 0 if it fails, to get that info you need to read the ResHacker.log file that is created. This is also pretty simple to do:

#AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, MyPicture.bmp, BITMAP, RESOURCENAME, 0
#AutoIt3Wrapper_Run_After=TYPE ResHacker.log

The new output now looks like this:

>Running:ResHacker.exe -add C:\MyScript.exe, C:\MyScript.exe, MyPicture.bmp, BITMAP, RESOURCENAME, 0
>ResHacker.exe -add C:\MyScript.exe, C:\MyScript.exe, MyPicture.bmp, BITMAP, RESOURCENAME, 0 Ended   rc:0
>Running:TYPE ResHacker.log
[19 Jan 2010, 21:26:22]
ResHacker.exe  -add C:\MyScript.exe, C:\MyScript.exe, MyPicture.bmp, BITMAP, RESOURCENAME, 0
 Added: BITMAP,RESOURCENAME,0

Commands completed
>TYPE ResHacker.log Ended   rc:0

And an example of it showing an error:

>ResHacker.exe -add C:\MyScript.exe, C:\MyScript.exe, MyPicture.bmp, BITMAP, RESOURCENAME, 0 Ended   rc:0
>Running:TYPE ResHacker.log
[19 Jan 2010, 21:32:10]
ResHacker.exe  -add C:\MyScript.exe, C:\MyScript.exe, MyPicture.bmp, BITMAP, RESOURCENAME, 0
Error: "MyPicture.bmp" does not exist
>TYPE ResHacker.log Ended   rc:0

As you can see, Reshacker on its own returns rc: 0, usually indicating no error. This would have gone completely unnoticed except for the log file, which shows the error and an explanation.

Other Run_After and Run_Before commands

You can use any commands you like in the Run_After and Run_Before directives. Examples such as "TYPE" have been shown above.

For a more complete list the following website is very useful: An A-Z Index of the Windows CMD Line

Other Wiki pages

Adding Utilities to the SciTE Tools Menu