Jump to content

New SciTE4AutoIt3 available with updated SciTE v3.4.4


Jos
 Share

Recommended Posts

Crossposting from another thread...

OK, the issue is this:

I use a standard user account.  I double click the SciTE installer (version from site that says updated 8/1/2014).  It pops up a UAC prompt.  After that it installs all the config files in the appdata directory for the administrator account rather than as the standard user I'm logged in as.  It also sets SCITE_USERHOME for the administrator, but not for the standard user.

Obviously this is because of UAC, but I believe this is not best practice behavior for an installer.

After manually copying the files to my standard user appdata directory and manually creating and setting to the right path the SCITE_USERHOME environment variable, I now have user calltips working.

Link to comment
Share on other sites

  • Developers

I haven't tested it with this scenario but assume this is very rarely used as you are the first one to report it.

So what would be the best practice on your views on this particular scenario?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I haven't tested it with this scenario but assume this is very rarely used as you are the first one to report it.

So what would be the best practice on your views on this particular scenario?

Jos

 

I've used both the NSIS UAC plugin and the "finish install on first run of application" methods for installers I've wrote before.

http://stackoverflow.com/questions/439932/getting-currently-logged-on-user-when-running-as-admin

Link to comment
Share on other sites

  • 5 weeks later...

I just downloaded the latest non-beta of Scite4AutoIt3 zip and found inside of it a SciTEUser.properties file, that file needs to not be there otherwise it will overwrite my user preferences. Actually on second look, it appears that there are a couple of more files in there that probably shouldn't be, au3.UserUdfs.properties, au3.keywords.user.abbreviations.properties, au3UserAbbrev.properties and maybe userabbrev.properties. These all appear to be files that the user should use to set certain personal preferences, I could be mistaken about the last 3 or 4, but not about the first one.

Link to comment
Share on other sites

  • 3 weeks later...

I use such a code:

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_GraphicsGetDPIRatio
; Description ...:
; Syntax ........: _GDIPlus_GraphicsGetDPIRatio([$iDPIDef = 96])
; Parameters ....: $iDPIDef             - [optional] An integer value. Default is 96.
; Return values .: None
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: http://www.autoitscript.com/forum/topic/159612-dpi-resolution-problem/?hl=%2Bdpi#entry1158317
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_GraphicsGetDPIRatio($iDPIDef = 96)
    _GDIPlus_Startup()
    Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0)
    If @error Then Return SetError(1, @extended, 0)
    Local $aResult
    #forcedef $__g_hGDIPDll, $ghGDIPDll
    If _IsBeta() Then
        $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0)
    Else
        $aResult = DllCall($ghGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0)
    EndIf

    If @error Then Return SetError(2, @extended, 0)
    Local $iDPI = $aResult[2]
    Local $aResults[2] = [$iDPIDef / $iDPI, $iDPI / $iDPIDef]
    _GDIPlus_GraphicsDispose($hGfx)
    _GDIPlus_Shutdown()
    Return $aResults
EndFunc   ;==>_GDIPlus_GraphicsGetDPIRatio

I see a problem with #forcedef directive

I think Au3Stripper removes this directive from myScript_Stripped.au3

and because of this I get error when AutoIt3Wrapper.exe force re check on myScript_Stripped.au3.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers

I see a problem with #forcedef directive

 

Try current Beta that should fix this.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I already use this version

Version 3.5.2 Dec 12 2014 20:43:37

edit:

Au3Stripper 14.801.2025.3

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers

I already use this version

Version 3.5.2 Dec 12 2014 20:43:37

edit:

Au3Stripper 14.801.2025.3

 

Not sure what this statement means but there was a v14.801.2025.4 and now v14.801.2025.5 with some fixes for other stuff.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

oh ...

My upgrading script was not complex in this area.
I was looking for size and date when I download but not checking time.

Sorry all is ok.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • 3 weeks later...

It seems that highlight.current.word.stopatspace=0 doesn't turn off the feature.  When I double click to highlight a string of characters the other matching strings in the script are highlighted until I reach a space.  I verified that the setting is set to 0.

here are my versions:

AU3Check Production ---- 3.3.13.19
AU3Check Beta ---------- 3.3.13.19
AU3Stripper ------------ 14.801.2025.5
AutoIt3 Production ----- 3.3.12.0
AutoIt3 Beta ----------- 3.3.13.19
AutoIt3Wrapper --------- 14.801.2025.3
AutoIt3WrapperToPragma - 0.0.0.0
Koda ------------------- 1.7.3.0
SciTE ------------------ 3.5.2.0
SciTEConfig ------------ 14.801.2025.1
SciTE Jump ------------- 2.18.103.243
Tidy ------------------- 14.801.2025.3

 Need any other info just let me know.

Edited by jaberwacky
Link to comment
Share on other sites

here are my versions:

AU3Check Production ---- 3.3.13.19
AU3Check Beta ---------- 3.3.13.19
AU3Stripper ------------ 14.801.2025.5
AutoIt3 Production ----- 3.3.12.0
AutoIt3 Beta ----------- 3.3.13.19
AutoIt3Wrapper --------- 14.801.2025.3
AutoIt3WrapperToPragma - 0.0.0.0
Koda ------------------- 1.7.3.0
SciTE ------------------ 3.5.2.0
SciTEConfig ------------ 14.801.2025.1
SciTE Jump ------------- 2.18.103.243
Tidy ------------------- 14.801.2025.3

 

Did you make a script for such raport ?

Can you share it ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers

It seems that highlight.current.word.stopatspace=0 doesn't turn off the feature.  When I double click to highlight a string of characters the other matching strings in the script are highlighted until I reach a space.  I verified that the setting is set to 0..

 

The parameter has a typo in the history file and should be: highlight.current.word.stoponspace

The SciTEGlobal.properties contains the correct naming.... sorry about that. :)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • 2 weeks later...

Please change default "Caret Line Color" in S4AU3 installation.

because on monitors with low contrast, this color is currently in basically, little perceptible.

I propose:

caret.line.back=#FFFED8

Edit:

and the same proposal for

selection.alpha=80
selection.back=#DE3041
Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers

The default for "caret.line.back" is already what you propose.

Either way, use the SciTEUser.properties to set you personal preferences as I am not even going to try to please everybody. :)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • 3 weeks later...

May I make a feature request?

Currently, if I want to comment out a multiline statement then I have to add a ; to the beginning of every line thus. 

;ConsoleWrite("----------------------------------------" & @CRLF & _
;             $nw_left & @TAB & $nw_top  & @CRLF & _
;             $n_left  & @TAB & $n_top   & @CRLF & _
;             $ne_left & @TAB & $ne_top  & @CRLF & _
;             $e_left  & @TAB & $e_top   & @CRLF & _
;             $se_left & @TAB & $se_top  & @CRLF & _
;             $s_left  & @TAB & $s_top   & @CRLF & _
;             $sw_left & @TAB & $sw_top  & @CRLF & _
;             $w_left  & @TAB & $w_top   & @CRLF)

 

I wonder if you would make it so that we only have to add a ; to the first line of a multiline statement?

I set out to analyze LexAU3.cxx to see if I could find a way to add this functionality.  I believe that I have but I haven't tested this.  It seems like the addition of an if statement found here on line 348 might do the trick.  What do you say, Jos?

// Scintilla source code edit control
// @file LexAU3.cxx
// Lexer for AutoIt3  http://www.hiddensoft.com/autoit3
// by Jos van der Zande, jvdzande@yahoo.com
//
// Changes:
// March 28, 2004 - Added the standard Folding code
// April 21, 2004 - Added Preprosessor Table + Syntax Highlighting
//                  Fixed Number highlighting
//                  Changed default isoperator to IsAOperator to have a better match to AutoIt3
//                  Fixed "#comments_start" -> "#comments-start"
//                  Fixed "#comments_end" -> "#comments-end"
//                  Fixed Sendkeys in Strings when not terminated with }
//                  Added support for Sendkey strings that have second parameter e.g. {UP 5} or {a down}
// April 26, 2004 - Fixed # pre-processor statement inside of comment block would invalidly change the color.
//                  Added logic for #include <xyz.au3> to treat the <> as string
//                  Added underscore to IsAOperator.
// May 17, 2004   - Changed the folding logic from indent to keyword folding.
//                  Added Folding logic for blocks of single-commentlines or commentblock.
//                        triggered by: fold.comment=1
//                  Added Folding logic for preprocessor blocks triggered by fold.preprocessor=1
//                  Added Special for #region - #endregion syntax highlight and folding.
// May 30, 2004   - Fixed issue with continuation lines on If statements.
// June 5, 2004   - Added comma to Operators for better readability.
//                  Added fold.compact support set with fold.compact=1
//                  Changed folding inside of #cs-#ce. Default is no keyword folding inside comment blocks when fold.comment=1
//                        it will now only happen when fold.comment=2.
// Sep 5, 2004    - Added logic to handle colourizing words on the last line.
//                        Typed Characters now show as "default" till they match any table.
// Oct 10, 2004   - Added logic to show Comments in "Special" directives.
// Nov  1, 2004   - Added better testing for Numbers supporting x and e notation.
// Nov 28, 2004   - Added logic to handle continuation lines for syntax highlighting.
// Jan 10, 2005   - Added Abbreviations Keyword used for expansion
// Mar 24, 2005   - Updated Abbreviations Keywords to fix when followed by Operator.
// Apr 18, 2005   - Updated #CE/#Comment-End logic to take a linecomment ";" into account
//                - Added folding support for With...EndWith
//                - Added support for a DOT in variable names
//                - Fixed Underscore in CommentBlock
// May 23, 2005   - Fixed the SentKey lexing in case of a missing }
// Aug 11, 2005   - Fixed possible bug with s_save length > 100.
// Aug 23, 2005   - Added Switch/endswitch support to the folding logic.
// Sep 27, 2005   - Fixed the SentKey lexing logic in case of multiple sentkeys.
// Mar 12, 2006   - Fixed issue with <> coloring as String in stead of Operator in rare occasions.
// Apr  8, 2006   - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF)
// Mar  9, 2007   - Fixed bug with + following a String getting the wrong Color.
// Jun 20, 2007   - Fixed Commentblock issue when LF's are used as EOL.
// Jul 26, 2007   - Fixed #endregion undetected bug.
//
// Copyright for Scintilla: 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Scintilla source code edit control

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>

#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"

#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"

#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif

static inline bool IsTypeCharacter(const int ch) {
    return ch == '$';
}

static inline bool IsAWordChar(const int ch) {
    return (ch < 0x80) && (isalnum(ch) || ch == '_');
}

static inline bool IsAWordStart(const int ch) {
    return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '@' || ch == '#' || ch == '$' || ch == '.');
}

static inline bool IsAOperator(char ch) {
    if (IsASCII(ch) && isalnum(ch))
    {
        return false;
    }
    
    if (ch == '+' || ch == '-' || ch == '*' || ch == '/' ||
        ch == '&' || ch == '^' || ch == '=' || ch == '<' || ch == '>' ||
        ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == ',' )
    {
        return true;
    }
    
    return false;
}

///////////////////////////////////////////////////////////////////////////////
// GetSendKey() filters the portion before and after a/multiple space(s)
// and return the first portion to be looked-up in the table
// also check if the second portion is valid... (up,down.on.off,toggle or a number)
///////////////////////////////////////////////////////////////////////////////
static int GetSendKey(const char *szLine, char *szKey) {
    int     nFlag       = 0;
    int     nStartFound = 0;
    int     nKeyPos     = 0;
    int     nSpecPos    = 0;
    int     nSpecNum    = 1;
    int     nPos        = 0;
    char    cTemp;
    char    szSpecial[100];

    // split the portion of the sendkey in the part before and after the spaces
    while (((cTemp = szLine[nPos]) != '\0'))
    {
        // skip leading Ctrl/Shift/Alt state
        if (cTemp == '{') 
        {
            nStartFound = 1;
        }
        
        if (nStartFound == 1) 
        {
            if ((cTemp == ' ') && (nFlag == 0)) // get the stuff till first space
            {
                nFlag = 1;
                
                // Add } to the end of the first bit for table lookup later.
                szKey[nKeyPos++] = '}';
            }
            else if (cTemp == ' ')
            {
                // skip other spaces
            }
            else if (nFlag == 0)
            {
                // save first portion into var till space or } is hit
                szKey[nKeyPos++] = cTemp;
            }
            else if ((nFlag == 1) && (cTemp != '}'))
            {
                // Save second portion into var...
                szSpecial[nSpecPos++] = cTemp;
                
                // check if Second portion is all numbers for repeat fuction
                if (isdigit(cTemp) == false) {nSpecNum = 0;}
            }
        }
        
        nPos++; // skip to next char
    } // End While

    // Check if the second portion is either a number or one of these keywords
    szKey[nKeyPos] = '\0';
    
    szSpecial[nSpecPos] = '\0';
    
    if (strcmp(szSpecial, "down")  == 0 || strcmp(szSpecial, "up")  == 0 ||
        strcmp(szSpecial, "on")    == 0 || strcmp(szSpecial, "off") == 0 ||
        strcmp(szSpecial, "toggle")== 0 || nSpecNum == 1 )
    {
        nFlag = 0;
    }
    else
    {
        nFlag = 1;
    }
    
    return nFlag;  // 1 is bad, 0 is good
} // GetSendKey()

///////////////////////////////////////////////////////////////////////////////
// Routine to check the last "none comment" character on a line to see if its a continuation
///////////////////////////////////////////////////////////////////////////////
static bool IsContinuationLine(unsigned int szLine, Accessor &styler) {
    int nsPos = styler.LineStart(szLine);
    
    int nePos = styler.LineStart(szLine + 1) - 2;
    
    //int stylech = styler.StyleAt(nsPos);
    while (nsPos < nePos)
    {
        //stylech = styler.StyleAt(nePos);
        int stylech = styler.StyleAt(nsPos);
        
        if (!(stylech == SCE_AU3_COMMENT)) 
        {
            char ch = styler.SafeGetCharAt(nePos);
            
            if (!isspacechar(ch)) 
            {
                if (ch == '_')
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
        
        nePos--; // skip to next char
    } // End While
    
    return false;
} // IsContinuationLine()

///////////////////////////////////////////////////////////////////////////////
// syntax highlighting logic
///////////////////////////////////////////////////////////////////////////////
static void ColouriseAU3Doc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
    WordList &keywords = *keywordlists[0];
    WordList &keywords2 = *keywordlists[1];
    WordList &keywords3 = *keywordlists[2];
    WordList &keywords4 = *keywordlists[3];
    WordList &keywords5 = *keywordlists[4];
    WordList &keywords6 = *keywordlists[5];
    WordList &keywords7 = *keywordlists[6];
    WordList &keywords8 = *keywordlists[7];

    // find the first previous line without continuation character at the end
    int lineCurrent = styler.GetLine(startPos);
    
    int s_startPos = startPos;
    
    // When not inside a Block comment: find First line without _
    if (!(initStyle == SCE_AU3_COMMENTBLOCK)) 
    {
        while ((lineCurrent > 0 && IsContinuationLine(lineCurrent, styler)) || (lineCurrent > 1 && IsContinuationLine(lineCurrent - 1, styler))) {
            lineCurrent--;
    
            startPos = styler.LineStart(lineCurrent); // get start position
        
            initStyle = 0; // reset the start style to 0
        }
    }
    
    // Set the new length to include it from the start and set the start position
    length = length + s_startPos - startPos; // correct the total length to process
    
    styler.StartAt(startPos);

    StyleContext sc(startPos, length, initStyle, styler);
    
    char si = 0; // string indicator "=1 '=2
    
    char ni = 0; // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3
    
    char ci = 0; // comment indicator 0=not linecomment(;)
    
    char s_save[100] = "";
    
    for ( ; sc.More() ; sc.Forward()) 
    {
        char s[100];
        
        sc.GetCurrentLowered(s, sizeof(s));
        
        // **********************************************
        // save the total current word for eof processing
        if (IsAWordChar(sc.ch) || sc.ch == '}')
        {
            strcpy(s_save, s);
            
            int tp = static_cast<int>(strlen(s_save));
            
            if (tp < 99) 
            {
                s_save[tp] = static_cast<char>(tolower(sc.ch));
                
                s_save[tp + 1] = '\0';
            }
        }
        // **********************************************
        
        switch (sc.state)
        {
            case SCE_AU3_COMMENTBLOCK:
            {
                //Reset at line end
                if (sc.atLineEnd && !IsContinuationLine(lineCurrent, styler)) 
                {
                    ci = 0;
                    
                    if (strcmp(s, "#ce") == 0 || strcmp(s, "#comments-end") == 0) 
                    {
                        if (sc.atLineEnd)
                        {
                            sc.SetState(SCE_AU3_DEFAULT);
                        }
                        else
                        {
                            sc.SetState(SCE_AU3_COMMENTBLOCK);
                        }
                    }
                    
                    break;
                }
                
                //skip rest of line when a ; is encountered
                if (sc.chPrev == ';') {
                    ci = 2;
                    
                    sc.SetState(SCE_AU3_COMMENTBLOCK);
                }
                
                // skip rest of the line
                if (ci == 2)
                {
                    break;
                }
                
                // check when first character is detected on the line
                if (ci == 0) 
                {
                    if (IsAWordStart(static_cast<char>(sc.ch)) || IsAOperator(static_cast<char>(sc.ch))) 
                    {
                        ci = 1;
                        
                        sc.SetState(SCE_AU3_COMMENTBLOCK);
                    }
                    
                    break;
                }
                
                if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && strcmp(s, "#comments") == 0))) 
                {
                    if ((strcmp(s, "#ce") == 0 || strcmp(s, "#comments-end") == 0))
                    {
                        sc.SetState(SCE_AU3_COMMENT);  // set to comment line for the rest of the line
                    }
                    else
                    {
                        ci = 2;  // line doesn't begin with #CE so skip the rest of the line
                    }
                }
                
                break;
            }
            case SCE_AU3_COMMENT:
            {
                if (IsContinuationLine(lineCurrent, styler))
                {
                    break;
                }
                    
                if (sc.atLineEnd) 
                {
                    
                    sc.SetState(SCE_AU3_DEFAULT);
                }
                
                break;
            }
            case SCE_AU3_OPERATOR:
            {
                // check if its a COMobject
                if (sc.chPrev == '.' && IsAWordChar(sc.ch)) 
                {
                    sc.SetState(SCE_AU3_COMOBJ);
                }
                else 
                {
                    sc.SetState(SCE_AU3_DEFAULT);
                }
                
                break;
            }
            case SCE_AU3_SPECIAL:
            {
                if (sc.ch == ';')
                {
                    sc.SetState(SCE_AU3_COMMENT);
                }
                
                if (sc.atLineEnd) 
                {
                    sc.SetState(SCE_AU3_DEFAULT);
                }
                
                break;
            }
            case SCE_AU3_KEYWORD:
            {
                if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && (strcmp(s, "#comments") == 0 || strcmp(s, "#include") == 0))))
                {
                    if (!IsTypeCharacter(sc.ch))
                    {
                        if (strcmp(s, "#cs") == 0 || strcmp(s, "#comments-start") == 0)
                        {
                            sc.ChangeState(SCE_AU3_COMMENTBLOCK);
                            
                            sc.SetState(SCE_AU3_COMMENTBLOCK);
                            
                            break;
                        }
                        else if (keywords.InList(s)) 
                        {
                            sc.ChangeState(SCE_AU3_KEYWORD);
                            
                            sc.SetState(SCE_AU3_DEFAULT);
                        }
                        else if (keywords2.InList(s)) 
                        {
                            sc.ChangeState(SCE_AU3_FUNCTION);
                            
                            sc.SetState(SCE_AU3_DEFAULT);
                        }
                        else if (keywords3.InList(s)) 
                        {
                            sc.ChangeState(SCE_AU3_MACRO);
                            
                            sc.SetState(SCE_AU3_DEFAULT);
                        }
                        else if (keywords5.InList(s)) 
                        {
                            sc.ChangeState(SCE_AU3_PREPROCESSOR);
                            
                            sc.SetState(SCE_AU3_DEFAULT);
                            
                            if (strcmp(s, "#include")== 0)
                            {
                                si = 3; // use to determine string start for #inlude <>
                            }
                        }
                        else if (keywords6.InList(s)) 
                        {
                            sc.ChangeState(SCE_AU3_SPECIAL);
                            
                            sc.SetState(SCE_AU3_SPECIAL);
                        }
                        else if ((keywords7.InList(s)) && (!IsAOperator(static_cast<char>(sc.ch)))) 
                        {
                            sc.ChangeState(SCE_AU3_EXPAND);
                            
                            sc.SetState(SCE_AU3_DEFAULT);
                        }
                        else if (keywords8.InList(s)) 
                        {
                            sc.ChangeState(SCE_AU3_UDF);
                            
                            sc.SetState(SCE_AU3_DEFAULT);
                        }
                        else if (strcmp(s, "_") == 0) 
                        {
                            sc.ChangeState(SCE_AU3_OPERATOR);
                            
                            sc.SetState(SCE_AU3_DEFAULT);
                        }
                        else if (!IsAWordChar(sc.ch)) 
                        {
                            sc.ChangeState(SCE_AU3_DEFAULT);
                            
                            sc.SetState(SCE_AU3_DEFAULT);
                        }
                    }
                }
                
                if (sc.atLineEnd) 
                {
                    sc.SetState(SCE_AU3_DEFAULT);
                }
                
                break;
            }
            case SCE_AU3_NUMBER:
            {
                // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 E-not=3
                
                // test for Hex notation
                if (strcmp(s, "0") == 0 && (sc.ch == 'x' || sc.ch == 'X') && ni == 0)
                {
                    ni = 2;
                    
                    break;
                }
                
                // test for E notation
                if (IsADigit(sc.chPrev) && (sc.ch == 'e' || sc.ch == 'E') && ni <= 1)
                {
                    ni = 3;
                    
                    break;
                }
                
                //  Allow Hex characters inside hex numeric strings
                if ((ni == 2) &&
                    (sc.ch == 'a' || sc.ch == 'b' || sc.ch == 'c' || sc.ch == 'd' || sc.ch == 'e' || sc.ch == 'f' ||
                     sc.ch == 'A' || sc.ch == 'B' || sc.ch == 'C' || sc.ch == 'D' || sc.ch == 'E' || sc.ch == 'F' ))
                {
                    break;
                }
                
                // test for 1 dec point only
                if (sc.ch == '.')
                {
                    if (ni == 0)
                    {
                        ni = 1;
                    }
                    else
                    {
                        ni = 9;
                    }
                    
                    break;
                }
                
                // end of numeric string ?
                if (!(IsADigit(sc.ch)))
                {
                    if (ni == 9)
                    {
                        sc.ChangeState(SCE_AU3_DEFAULT);
                    }
                    
                    sc.SetState(SCE_AU3_DEFAULT);
                }
                
                break;
            }
            case SCE_AU3_VARIABLE:
            {
                // Check if its a COMObject
                if (sc.ch == '.' && !IsADigit(sc.chNext))
                {
                    sc.SetState(SCE_AU3_OPERATOR);
                }
                else if (!IsAWordChar(sc.ch)) 
                {
                    sc.SetState(SCE_AU3_DEFAULT);
                }
                
                break;
            }
            case SCE_AU3_COMOBJ:
            {
                if (!(IsAWordChar(sc.ch))) 
                {
                    sc.SetState(SCE_AU3_DEFAULT);
                }
                
                break;
            }
            case SCE_AU3_STRING:
            {
                // check for " to end a double qouted string or
                // check for ' to end a single qouted string
                if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>'))
                {
                    sc.ForwardSetState(SCE_AU3_DEFAULT);
                    
                    si = 0;
                    
                    break;
                }
                
                if (sc.atLineEnd)
                {
                    si = 0;
                    
                    // at line end and not found a continuation char then reset to default
                    int lineCurrent = styler.GetLine(sc.currentPos);
                    
                    if (!IsContinuationLine(lineCurrent,styler))
                    {
                        sc.SetState(SCE_AU3_DEFAULT);
                        
                        break;
                    }
                }
                
                // find Sendkeys in a STRING
                if (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ) 
                {
                    sc.SetState(SCE_AU3_SENT);
                }
                
                break;
            }
            case SCE_AU3_SENT:
            {
                // Send key string ended
                if (sc.chPrev == '}' && sc.ch != '}')
                {
                    // set color to SENDKEY when valid sendkey .. else set back to regular string
                    char sk[100];
                    
                    // split {111 222} and return {111} and check if 222 is valid.
                    // if return code = 1 then invalid 222 so must be string
                    if (GetSendKey(s,sk))
                    {
                        sc.ChangeState(SCE_AU3_STRING);
                    }
                    // if single char between {?} then its ok as sendkey for a single character
                    else if (strlen(sk) == 3)
                    {
                        sc.ChangeState(SCE_AU3_SENT);
                    }
                    // if sendkey {111} is in table then ok as sendkey
                    else if (keywords4.InList(sk))
                    {
                        sc.ChangeState(SCE_AU3_SENT);
                    }
                    else
                    {
                        sc.ChangeState(SCE_AU3_STRING);
                    }
                    
                    sc.SetState(SCE_AU3_STRING);
                }
                else
                {
                    // check if the start is a valid SendKey start
                    int nPos = 0;
                    
                    int nState = 1;
                    
                    char cTemp;
                    
                    while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
                    {
                        if (cTemp == '{' && nState == 1)
                        {
                            nState = 2;
                        
                            
                        if (nState == 1 && !(cTemp == '+' || cTemp == '!' || cTemp == '^' || cTemp == '#' ))
                        {
                            nState = 0;
                        }
                        
                        nPos++;
                    }
                    
                    //Verify characters infront of { ... if not assume  regular string
                    if (nState == 1 && (!(sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ))) 
                    {
                        sc.ChangeState(SCE_AU3_STRING);
                        
                        sc.SetState(SCE_AU3_STRING);
                    }
                    
                    // If invalid character found then assume its a regular string
                    if (nState == 0) 
                    {
                        sc.ChangeState(SCE_AU3_STRING);
                        
                        sc.SetState(SCE_AU3_STRING);
                    }
                }
                
                // check if next portion is again a sendkey
                if (sc.atLineEnd)
                {
                    sc.ChangeState(SCE_AU3_STRING);
                    
                    sc.SetState(SCE_AU3_DEFAULT);
                    
                    si = 0;  // reset string indicator
                }
                
                //* check in next characters following a sentkey are again a sent key
                // Need this test incase of 2 sentkeys like {F1}{ENTER} but not detect {{}
                if (sc.state == SCE_AU3_STRING && (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' )) 
                {
                    sc.SetState(SCE_AU3_SENT);
                }
                    
                // check to see if the string ended...
                // Sendkey string isn't complete but the string ended....
                if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\''))
                {
                    sc.ChangeState(SCE_AU3_STRING);
                    sc.ForwardSetState(SCE_AU3_DEFAULT);
                }
                
                break;
            }
        } //switch (sc.state)

        // Determine if a new state should be entered:
        if (sc.state == SCE_AU3_DEFAULT)
        {
            if (sc.ch == ';') 
            {
                sc.SetState(SCE_AU3_COMMENT);
            }
            else if (sc.ch == '#') 
            {
                sc.SetState(SCE_AU3_KEYWORD);
            }
            else if (sc.ch == '$') 
            {
                sc.SetState(SCE_AU3_VARIABLE);
            }
            else if (sc.ch == '.' && !IsADigit(sc.chNext)) 
            {
                sc.SetState(SCE_AU3_OPERATOR);
            }
            else if (sc.ch == '@') 
            {
                sc.SetState(SCE_AU3_KEYWORD);
            }
            //else if (sc.ch == '_') 
            //{
            //    sc.SetState(SCE_AU3_KEYWORD);
            //}
            else if (sc.ch == '<' && si==3) 
            {
                sc.SetState(SCE_AU3_STRING); // string after #include
            }
            else if (sc.ch == '\"') 
            {
                sc.SetState(SCE_AU3_STRING);
                
                si = 1; 
            }
            else if (sc.ch == '\'') 
            {
                sc.SetState(SCE_AU3_STRING);
                
                si = 2; 
            }
            else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)))
            {
                sc.SetState(SCE_AU3_NUMBER);
                
                ni = 0;
            }
            else if (IsAWordStart(sc.ch)) 
            {
                sc.SetState(SCE_AU3_KEYWORD);
            }
            else if (IsAOperator(static_cast<char>(sc.ch))) 
            {
                sc.SetState(SCE_AU3_OPERATOR);
            }
            else if (sc.atLineEnd)
            {
                sc.SetState(SCE_AU3_DEFAULT);
            }
        }
    } //for (; sc.More(); sc.Forward())

    //*************************************
    // Colourize the last word correctly
    //*************************************
    if (sc.state == SCE_AU3_KEYWORD)
    {
        if (strcmp(s_save, "#cs")== 0 || strcmp(s_save, "#comments-start")== 0 )
        {
            sc.ChangeState(SCE_AU3_COMMENTBLOCK);
            
            sc.SetState(SCE_AU3_COMMENTBLOCK);
        }
        else if (keywords.InList(s_save)) 
        {
            sc.ChangeState(SCE_AU3_KEYWORD);
            
            sc.SetState(SCE_AU3_KEYWORD);
        }
        else if (keywords2.InList(s_save)) 
        {
            sc.ChangeState(SCE_AU3_FUNCTION);
            
            sc.SetState(SCE_AU3_FUNCTION);
        }
        else if (keywords3.InList(s_save)) 
        {
            sc.ChangeState(SCE_AU3_MACRO);
            
            sc.SetState(SCE_AU3_MACRO);
        }
        else if (keywords5.InList(s_save)) 
        {
            sc.ChangeState(SCE_AU3_PREPROCESSOR);
            
            sc.SetState(SCE_AU3_PREPROCESSOR);
        }
        else if (keywords6.InList(s_save)) 
        {
            sc.ChangeState(SCE_AU3_SPECIAL);
            
            sc.SetState(SCE_AU3_SPECIAL);
        }
        else if (keywords7.InList(s_save) && sc.atLineEnd) 
        {
            sc.ChangeState(SCE_AU3_EXPAND);
            
            sc.SetState(SCE_AU3_EXPAND);
        }
        else if (keywords8.InList(s_save)) 
        {
            sc.ChangeState(SCE_AU3_UDF);
            
            sc.SetState(SCE_AU3_UDF);
        }
        else {
            sc.ChangeState(SCE_AU3_DEFAULT);
            
            sc.SetState(SCE_AU3_DEFAULT);
        }
    }
    
    if (sc.state == SCE_AU3_SENT)
    {
        // Send key string ended
        if (sc.chPrev == '}' && sc.ch != '}')
        {
            // set color to SENDKEY when valid sendkey .. else set back to regular string
            char sk[100];
            
            // split {111 222} and return {111} and check if 222 is valid.
            // if return code = 1 then invalid 222 so must be string
            if (GetSendKey(s_save,sk))
            {
                sc.ChangeState(SCE_AU3_STRING);
            }
            // if single char between {?} then its ok as sendkey for a single character
            else if (strlen(sk) == 3)
            {
                sc.ChangeState(SCE_AU3_SENT);
            }
            // if sendkey {111} is in table then ok as sendkey
            else if (keywords4.InList(sk))
            {
                sc.ChangeState(SCE_AU3_SENT);
            }
            else
            {
                sc.ChangeState(SCE_AU3_STRING);
            }
            
            sc.SetState(SCE_AU3_STRING);
        }
        
        // check if next portion is again a sendkey
        if (sc.atLineEnd)
        {
            sc.ChangeState(SCE_AU3_STRING);
            
            sc.SetState(SCE_AU3_DEFAULT);
        }
    }
    //*************************************
    
    sc.Complete();
}

static bool IsStreamCommentStyle(int style) {
    return style == SCE_AU3_COMMENT || style == SCE_AU3_COMMENTBLOCK;
}

///////////////////////////////////////////////////////////////////////////////
// Routine to find first none space on the current line and return its Style
// needed for comment lines not starting on pos 1
///////////////////////////////////////////////////////////////////////////////
static int GetStyleFirstWord(unsigned int szLine, Accessor &styler) {
    int nsPos = styler.LineStart(szLine);
    
    int nePos = styler.LineStart(szLine + 1) - 1;
    
    while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos)
    {
        nsPos++; // skip to next char
    } // End While
    
    return styler.StyleAt(nsPos);
} // GetStyleFirstWord()

static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
    int endPos = startPos + length;
    // get settings from the config files for folding comments and preprocessor lines
    bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
    bool foldInComment = styler.GetPropertyInt("fold.comment") == 2;
    bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
    bool foldpreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
    // Backtrack to previous line in case need to fix its fold status
    int lineCurrent = styler.GetLine(startPos);
    if (startPos > 0) {
        if (lineCurrent > 0) {
            lineCurrent--;
            startPos = styler.LineStart(lineCurrent);
        }
    }
    // vars for style of previous/current/next lines
    int style = GetStyleFirstWord(lineCurrent,styler);
    int stylePrev = 0;
    // find the first previous line without continuation character at the end
    while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) ||
           (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) {
        lineCurrent--;
        startPos = styler.LineStart(lineCurrent);
    }
    if (lineCurrent > 0) {
        stylePrev = GetStyleFirstWord(lineCurrent-1,styler);
    }
    // vars for getting first word to check for keywords
    bool FirstWordStart = false;
    bool FirstWordEnd = false;
    char szKeyword[11]="";
    int  szKeywordlen = 0;
    char szThen[5]="";
    int  szThenlen = 0;
    bool ThenFoundLast = false;
    // var for indentlevel
    int levelCurrent = SC_FOLDLEVELBASE;
    if (lineCurrent > 0)
        levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
    int levelNext = levelCurrent;
    //
    int visibleChars = 0;
    char chNext = styler.SafeGetCharAt(startPos);
    char chPrev = ' ';
    //
    for (int i = startPos; i < endPos; i++) {
        char ch = chNext;
        chNext = styler.SafeGetCharAt(i + 1);
        if (IsAWordChar(ch)) {
            visibleChars++;
        }
        // get the syle for the current character neede to check in comment
        int stylech = styler.StyleAt(i);
        // get first word for the line for indent check max 9 characters
        if (FirstWordStart && (!(FirstWordEnd))) {
            if (!IsAWordChar(ch)) {
                FirstWordEnd = true;
                szKeyword[szKeywordlen] = '\0';
            }
            else {
                if (szKeywordlen < 10) {
                szKeyword[szKeywordlen++] = static_cast<char>(tolower(ch));
                }
            }
        }
        // start the capture of the first word
        if (!(FirstWordStart)) {
            if (IsAWordChar(ch) || IsAWordStart(ch) || ch == ';') {
                FirstWordStart = true;
                szKeyword[szKeywordlen++] = static_cast<char>(tolower(ch));
            }
        }
        // only process this logic when not in comment section
        if (!(stylech == SCE_AU3_COMMENT)) {
            if (ThenFoundLast) {
                if (IsAWordChar(ch)) {
                    ThenFoundLast = false;
                }
            }
            // find out if the word "then" is the last on a "if" line
            if (FirstWordEnd && strcmp(szKeyword,"if") == 0) {
                if (szThenlen == 4) {
                    szThen[0] = szThen[1];
                    szThen[1] = szThen[2];
                    szThen[2] = szThen[3];
                    szThen[3] = static_cast<char>(tolower(ch));
                    if (strcmp(szThen,"then") == 0 ) {
                        ThenFoundLast = true;
                    }
                }
                else {
                    szThen[szThenlen++] = static_cast<char>(tolower(ch));
                    if (szThenlen == 5) {
                        szThen[4] = '\0';
                    }
                }
            }
        }
        // End of Line found so process the information
        if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) {
            // **************************
            // Folding logic for Keywords
            // **************************
            // if a keyword is found on the current line and the line doesn't end with _ (continuation)
            //    and we are not inside a commentblock.
            if (szKeywordlen > 0 && (!(chPrev == '_')) &&
                ((!(IsStreamCommentStyle(style)) || foldInComment)) ) {
                szKeyword[szKeywordlen] = '\0';
                // only fold "if" last keyword is "then"  (else its a one line if)
                if (strcmp(szKeyword,"if") == 0  && ThenFoundLast) {
                        levelNext++;
                }
                // create new fold for these words
                if (strcmp(szKeyword,"do") == 0   || strcmp(szKeyword,"for") == 0 ||
                    strcmp(szKeyword,"func") == 0 || strcmp(szKeyword,"while") == 0||
                    strcmp(szKeyword,"with") == 0 || strcmp(szKeyword,"#region") == 0 ) {
                        levelNext++;
                }
                // create double Fold for select&switch because Case will subtract one of the current level
                if (strcmp(szKeyword,"select") == 0 || strcmp(szKeyword,"switch") == 0) {
                        levelNext++;
                        levelNext++;
                }
                // end the fold for these words before the current line
                if (strcmp(szKeyword,"endfunc") == 0 || strcmp(szKeyword,"endif") == 0 ||
                    strcmp(szKeyword,"next") == 0    || strcmp(szKeyword,"until") == 0 ||
                    strcmp(szKeyword,"endwith") == 0 ||strcmp(szKeyword,"wend") == 0){
                        levelNext--;
                        levelCurrent--;
                }
                // end the fold for these words before the current line and Start new fold
                if (strcmp(szKeyword,"case") == 0      || strcmp(szKeyword,"else") == 0 ||
                    strcmp(szKeyword,"elseif") == 0 ) {
                        levelCurrent--;
                }
                // end the double fold for this word before the current line
                if (strcmp(szKeyword,"endselect") == 0 || strcmp(szKeyword,"endswitch") == 0 ) {
                        levelNext--;
                        levelNext--;
                        levelCurrent--;
                        levelCurrent--;
                }
                // end the fold for these words on the current line
                if (strcmp(szKeyword,"#endregion") == 0 ) {
                        levelNext--;
                }
            }
            // Preprocessor and Comment folding
            int styleNext = GetStyleFirstWord(lineCurrent + 1,styler);
            // *************************************
            // Folding logic for preprocessor blocks
            // *************************************
            // process preprosessor line
            if (foldpreprocessor && style == SCE_AU3_PREPROCESSOR) {
                if (!(stylePrev == SCE_AU3_PREPROCESSOR) && (styleNext == SCE_AU3_PREPROCESSOR)) {
                    levelNext++;
                }
                // fold till the last line for normal comment lines
                else if (stylePrev == SCE_AU3_PREPROCESSOR && !(styleNext == SCE_AU3_PREPROCESSOR)) {
                    levelNext--;
                }
            }
            // *********************************
            // Folding logic for Comment blocks
            // *********************************
            if (foldComment && IsStreamCommentStyle(style)) {
                // Start of a comment block
                if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) {
                    levelNext++;
                }
                // fold till the last line for normal comment lines
                else if (IsStreamCommentStyle(stylePrev)
                        && !(styleNext == SCE_AU3_COMMENT)
                        && stylePrev == SCE_AU3_COMMENT
                        && style == SCE_AU3_COMMENT) {
                    levelNext--;
                }
                // fold till the one but last line for Blockcomment lines
                else if (IsStreamCommentStyle(stylePrev)
                        && !(styleNext == SCE_AU3_COMMENTBLOCK)
                        && style == SCE_AU3_COMMENTBLOCK) {
                    levelNext--;
                    levelCurrent--;
                }
            }
            int levelUse = levelCurrent;
            int lev = levelUse | levelNext << 16;
            if (visibleChars == 0 && foldCompact)
                lev |= SC_FOLDLEVELWHITEFLAG;
            if (levelUse < levelNext) {
                lev |= SC_FOLDLEVELHEADERFLAG;
            }
            if (lev != styler.LevelAt(lineCurrent)) {
                styler.SetLevel(lineCurrent, lev);
            }
            // reset values for the next line
            lineCurrent++;
            stylePrev = style;
            style = styleNext;
            levelCurrent = levelNext;
            visibleChars = 0;
            // if the last character is an Underscore then don't reset since the line continues on the next line.
            if (!(chPrev == '_')) {
                szKeywordlen = 0;
                szThenlen = 0;
                FirstWordStart = false;
                FirstWordEnd = false;
                ThenFoundLast = false;
            }
        }
        // save the last processed character
        if (!isspacechar(ch)) {
            chPrev = ch;
            visibleChars++;
        }
    }
}

static const char * const AU3WordLists[] = {
    "#autoit keywords",
    "#autoit functions",
    "#autoit macros",
    "#autoit Sent keys",
    "#autoit Pre-processors",
    "#autoit Special",
    "#autoit Expand",
    "#autoit UDF",
    0
};

LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists);
Link to comment
Share on other sites

  • Developers

Which line did you changen, as winmerge of the posted code with the current source in the general SciLexer does have many differences due to some tidy process?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked and unpinned this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...