Jump to content

BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs


Jos
 Share

Recommended Posts

1 hour ago, Jos said:

Just check any/all your cache tables related to this include for the UDF

I had the same issue as @donnyh13 
And after I delete all the *dyn*.tbl files the issue is gone.
Thanks @Jos

 

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

Thanks @Jos and @mLipok, but I actually already tried deleting every tbl file that was present. Same problem.  I have just tried deleting both scite folders and reinstalling. Same problem. But I found at least the steps to re-create it now.

Calling FormFill from a separate script with WinHTTP only as an include, displays correctly:

2.thumb.png.febb5caa7b5043f9d8f2079f67300784.png

Calling FormFill while in WinHTTP script itself (which I was doing for testing) displays with the underscores. Perhaps I misunderstood when/where the underscores were to be removed?

1.thumb.png.f106e01d193b10280331f15def5f3e9c.png

And this entry in au3.file.dynamic.calltips.api

_WinHttpSimpleFormFill (ByRef $hInternet, $sActionPage=Default, $sFormId=Default, $sFldId1=Default, $sDta1=Default, $sFldId2=Default, $sDta2=Default, \n   $sFldId3=Default, $sDta3=Default, $sFldId4=Default, $sDta4=Default, $sFldId5=Default, $sDta5=Default, $sFldId6=Default, $sDta6=Default, $sFldId7=Default, \n   $sDta7=Default, $sFldId8=Default, $sDta8=Default, $sFldId9=Default, $sDta9=Default, $sFldId10=Default, $sDta10=Default, _$sFldId11=Default, $sDta11=Default, \n   $sFldId12=Default, $sDta12=Default, $sFldId13=Default, $sDta13=Default, $sFldId14=Default, $sDta14=Default, $sFldId15=Default, $sDta15=Default, \n   $sFldId16=Default, $sDta16=Default, $sFldId17=Default, $sDta17=Default, $sFldId18=Default, $sDta18=Default, $sFldId19=Default, $sDta19=Default, \n   $sFldId20=Default, $sDta20=Default, _$sFldId21=Default, $sDta21=Default, $sFldId22=Default, $sDta22=Default, $sFldId23=Default, $sDta23=Default, \n   $sFldId24=Default, $sDta24=Default, $sFldId25=Default, $sDta25=Default, $sFldId26=Default, $sDta26=Default, $sFldId27=Default, $sDta27=Default, \n   $sFldId28=Default, $sDta28=Default, $sFldId29=Default, $sDta29=Default, $sFldId30=Default, $sDta30=Default, _$sFldId31=Default, $sDta31=Default, \n   $sFldId32=Default, $sDta32=Default, $sFldId33=Default, $sDta33=Default, $sFldId34=Default, $sDta34=Default, $sFldId35=Default, $sDta35=Default, \n   $sFldId36=Default, $sDta36=Default, $sFldId37=Default, $sDta37=Default, $sFldId38=Default, $sDta38=Default, $sFldId39=Default, $sDta39=Default, \n   $sFldId40=Default,  $sDta40=Default)  (in current file)

 

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers
5 minutes ago, donnyh13 said:

Calling FormFill while in WinHTTP script itself (which I was doing for testing) displays with the underscores. Perhaps I misunderstood when/where the underscores were to be removed?

That is helpful and will have a look to check that. I have already made some more change for editing any standard udf files, so this might already be fixed...  More later

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

Thanks @Jos

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers

Please try latest version of the scripts as I was able to replicate and hopefully fix this also for you. :) 

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

Thanks Jos. Just tried it, it seems fixed!.

By the way.... Your Scite installer has some goodies included in it. :) (In the Lua folder)

1.png.3c6c838052ef91937b4c8f95d80a7af7.png

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers

Yea I know it did, but it shouldn't be in the current jan 4 version anymore, as I updated both the Exe and Portable zip removing those extra files.

They aren't removed by the installer unless a full uninstall is done.

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

Ah, I have an old installer. Sorry.

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

@Jos I just did a test by adding consecutive commas separating each parameter:

_WinHttpSimpleFormFill(,,,,

call tip appears correctly - showing correct parameter.

image.thumb.png.e81c077476375cfb9a3321892cc0930f.png

 

When I type "X" correct parameter is highlighted

image.thumb.png.23521d4e67fa4c09a19ba8e1e92a9608.png

When I delete few comma/parameters then it still highilight the $sData2 instead $sActionPage:

image.thumb.png.fcb808a4abe940a0a58c1217b623d656.png

 

Is it something related to LUA or to internal SciTE (N.H.) ?

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
3 hours ago, mLipok said:

Is it something related to LUA or to internal SciTE (N.H.) ?

That is a known internal thing which I've noticed for ages but honestly not too bothered about it

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

Hi Jos.

I was wondering if there is any kind of setting in Scite that you can think of, for delay, or time out, when opening scripts for editing (When Scite is already open)? Or if this is  a bug?  If I select several scripts, 4, 6, 8, etc. and right click and select edit script, often the already running Scite instance opens most of them, but one or two open in a new Scite instance.

I'm not sure who is to blame, either windows or Scite, but I'm guessing either one or the other sees Scite as unresponsive eventually and tries opening a new instance ?

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

Hi Jos,

I was wondering if the wrapping function (in AutoIt.Tools.lua, line 592+) for syntax

if fBroken then
                    if string.len(paramSynt) + string.len(parameter) + iOptionals + 2 + 19 > defLineMax then
                        outSyntax = outSyntax .. paramSynt .. nl .. ';' .. string.rep(' ', 18)
                        paramSynt = ''
                        fBroken = true
                    end
                else
                    if string.len(outSyntax) + string.len(paramSynt) + string.len(parameter) + iOptionals + 2 + 19 > defLineMax then
                        outSyntax = outSyntax .. paramSynt .. nl .. ';' .. string.rep(' ', 18)
                        paramSynt = ''
                        fBroken = true
                    end
                end

used in the Header creation tool (ctrl+alt_h) is still necessary? The UDF spec seems to indicate that the Syntax line shouldn't be wrapped, and as far as I have also heard, wrapping headers to 129 column is no longer needed anyway?

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers

This UDF isn't written by me nor do I ever use it, so any proposal for change that makes sense and is agreed upon by this community can be integrated. :) 

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

Okay, sounds good Jos. Thanks for the info. So post a separate post and make a vote?

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers

No voting needed as far as i am concerned, just post the changed code here so people can respond in case they want. I will gladly update the file after.

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

19 hours ago, donnyh13 said:

The UDF spec seems to indicate that the Syntax line shouldn't be wrapped, and as far as I have also heard, wrapping headers to 129 column is no longer needed anyway?

So far, the UDF specification has indicated that the syntax line should be wrapped.

Quote

The header is 129 characters wide, and any text within it should be wrapped to that length.

It was discussed in MVP forum because I sow how terrible it looked in very advanced UDFs (especially yours LibreOffice UDF) and considering that a lot has changed since this specification was introduced (18:33, 24 September 2012‎), I mean above all the quality and size of computer monitors solves the problem of the need to wrap text but also including AutoIt.chm for which this specification was prepared.

As the last unrebutted arguments (in MVP discussion) were for removing this restriction, and considering that 2 months have passed since that discussion and nothing new has been contributed, as a result I have just made a change:

https://www.autoitscript.com/w/index.php?title=UDF-spec&curid=2813&diff=14883&oldid=14099

Current version you can see here:

https://www.autoitscript.com/wiki/UDF-spec

 


 

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

38 minutes ago, mLipok said:

UDF specification has indicated that the syntax line should be wrapped

What I meant was the actual Syntax line, which UDF spec actually indicated shouldn't be wrapped.

Quote

The exception to that rule is the Syntax line, which should not be wrapped.

But the changes to wiki look good to me @mLipok.

And I also agree, that now line wrapping seems unneeded. Even Scite has a built in Line wrap feature.

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

Hi Jos,
This is what I have done so far. I think that is all that is needed?
- Removed the following section used for wrapping the syntax line.

if fBroken then
                    if string.len(paramSynt) + string.len(parameter) + iOptionals + 2 + 19 > defLineMax then
                        outSyntax = outSyntax .. paramSynt .. nl .. ';' .. string.rep(' ', 18)
                        paramSynt = ''
                        fBroken = true
                    end
                else
                    if string.len(outSyntax) + string.len(paramSynt) + string.len(parameter) + iOptionals + 2 + 19 > defLineMax then
                        outSyntax = outSyntax .. paramSynt .. nl .. ';' .. string.rep(' ', 18)
                        paramSynt = ''
                        fBroken = true
                    end
                end


- Removed the declaration of the variable fBroken (it wont be used anymore)

local fBroken = false

 

- ReArranged and modified the section for determining the Parameter type as follows:
1. Moved the check for “fu”, “tag”, and “id” to the top of the “if” block.
2. Changed the check for “id”, it was never possible to be true before (it was checking if a one character string matched “id”). It was always being identified as an integer instead.
3. Arranged the remaining elseif’s into alphabetical order.
4. Changed the parameter type “id” from “AutoIt controlid” to “AutoIt controlID”
5. Added parameter type “e” -- “constant variant” to the list. Is this proper?
6. Added parameter type “a” -- “array”. There is already a check for Array, but once found, it tries to determine the subtype, which if it was another array (Local $aaText), it would say it was an array of unknowns. Is this good?
- If the parameter is an array, I added a new variable, iStart, so that when determining the subtype a search for “id” and “tag” etc. can still be performed.

I did a simple test, and all seems to work? I would be interested in hearing your and @mLipok’s input.

Complete new code:

--------------------------------------------------------------------------------
-- CreateFunctionHeader(s, p)
--
-- Creates a function header for an AutoIt 3 function.
--
-- Parameters:
--  s - The name of a function.
--  p - The parameters to the function.
--
-- Returns:
--  A string containing the function header.
--------------------------------------------------------------------------------
function AutoItTools:CreateFunctionHeader(s, p)
    -- Change these :)
    local defAuthor = props['UDFCreator'] -- Initial Author value
    local defLineMax = 129              -- Max length of line. AutoIt standard is 129.
    local defSplit = 21                 -- Default index for '-' after param.

    local nl = self:NewLineInUse()

    local outStart = 'FUNCTION'
    local outName = s
    local outDesc = ''
    local outSyntax = ''
    local outParams = ''
    local outReturn = 'None'
    local outAuthor = defAuthor
    local outModify = ''
    local outRemarks = ''
    local outRelated = ''
    local outLink = ''
    local outExample = 'No'

    local name = s
    local params = string.gsub(p, '[Ff][Uu][Nn][Cc].-%((.*)%)', '(%1)')

    if name:sub(0, 2) == '__' then
        outStart = 'INTERNAL_USE_ONLY'
    end

    outSyntax = name .. '('

    local paramSynt = ''
    local iOptionals = 0
    local sModifiers = ''
    if params ~= '()' and params ~= nil then
        for byref, parameter, optional in string.gmatch(params, '(%w-%s*%w*)%s*($[%w_]+)%s*[=]?%s*(.-)[,%)]') do
            if parameter ~= '' and parameter ~= nil then
                if outParams ~= '' then
                    outParams = outParams .. nl .. ';' .. string.rep(' ', 18)
                end

                outParams = outParams .. parameter .. string.rep(' ', defSplit - string.len(parameter)) .. '- '

                sModifiers = ''
                if optional ~= '' and optional ~= nil then
                    outParams = outParams .. '[optional] '

                    if paramSynt ~= '' then
                        paramSynt = paramSynt .. '[, '
                    else
                        paramSynt = paramSynt .. '['
                    end

                    iOptionals = iOptionals + 1
                else
                    byref = string.gsub(byref:lower(), '%s', '')
                    if byref ~= '' then
                        if byref == 'byref' then
                            outParams = outParams .. '[in/out] '
                            sModifiers = 'ByRef '
                        else
                            if byref == 'const' then
                                outParams = outParams .. '[const] '
                                sModifiers = 'Const '
                            else
                                if byref == 'byrefconst' or byref == 'constbyref' then
                                    outParams = outParams .. '[in/out and const] '
                                    sModifiers = 'Const ByRef '
                                else
                                    print("Unrecognised parameter modifiers: '" .. byref .. "'")
                                end
                            end
                        end
                    end

                    if paramSynt ~= '' then
                        paramSynt = paramSynt .. ', '
                    end
                end
                
                paramSynt = paramSynt .. sModifiers .. parameter

                if optional ~= '' and optional ~= nil then
                    paramSynt = paramSynt .. ' = ' .. optional
                end

                local paramtype = parameter:sub(2, 2)
                local isarray = false
                local iStart = 2
                if paramtype == 'a' then
                    paramtype = parameter:sub(3, 3)
                    isarray = true
                    iStart = 3
                end

                local sAdd
                
                if parameter:sub(iStart, iStart + 1) == 'fu' then
                    sAdd = 'function (first class object)'
                elseif parameter:sub(iStart, iStart + 2) == 'tag' then
                    sAdd = 'structures definition'
                elseif parameter:sub(iStart, iStart + 1) == 'id' then
                    sAdd = 'AutoIt controlID'
                elseif paramtype == 'a' then
                    sAdd = 'array'
                elseif paramtype == 'b' then
                    sAdd = 'boolean'
                elseif paramtype == 'd' then
                    sAdd = 'binary variant'
                elseif paramtype == 'e' then
                    sAdd = 'constant variant'
                elseif paramtype == 'f' then
                    sAdd = 'floating point'
                elseif paramtype == 'h' then
                    sAdd = 'handle' 
                elseif paramtype == 'i' then
                    sAdd = 'integer'
                elseif paramtype == 'm' then
                    sAdd = 'map'
                elseif paramtype == 'n' then
                    sAdd = 'general number'
                elseif paramtype == 'o' then
                    sAdd = 'object' 
                elseif paramtype == 'p' then
                    sAdd = 'pointer'    
                elseif paramtype == 's' then
                    sAdd = 'string'
                elseif paramtype == 't' then
                    sAdd = 'dll struct'
                elseif paramtype == 'v' then
                    sAdd = 'variant'
                else
                    sAdd = 'unknown'
                end

                if isarray then
                    outParams = outParams .. 'an array of ' .. sAdd .. 's.'
                else
                    if sAdd == 'object' then
                        outParams = outParams .. 'an ' .. sAdd .. '.'
                    elseif sAdd == 'map' then
                        outParams = outParams .. 'a ' .. sAdd .. '.'
                    elseif sAdd == 'structures definition' then
                        outParams = outParams .. 'a ' .. sAdd .. '.'
                    elseif sAdd == 'function (first class object)' then
                        outParams = outParams .. '' .. sAdd .. '.'
                    else
                        if sAdd:sub(1, 1):find('[AEIOUaeiou]') ~= nil then
                            outParams = outParams .. 'an ' .. sAdd .. ' value.'
                        else
                            outParams = outParams .. 'a ' .. sAdd .. ' value.'
                        end
                    end
                end

                if optional ~= '' and optional ~= nil then
                    outParams = outParams .. ' Default is ' .. optional .. '.'
                end
            end
        end
    else
        outParams = 'None'
    end

    outSyntax = outSyntax .. paramSynt .. string.rep(']', iOptionals) .. ')'

    local res = '; #' .. outStart .. '# ' .. string.rep('=', defLineMax - 5 - outStart:len()) .. nl
    res = res .. '; Name ..........: ' .. outName .. nl
    res = res .. '; Description ...: ' .. outDesc .. nl
    res = res .. '; Syntax ........: ' .. outSyntax .. nl
    res = res .. '; Parameters ....: ' .. outParams .. nl
    res = res .. '; Return values .: ' .. outReturn .. nl
    res = res .. '; Author ........: ' .. outAuthor .. nl
    res = res .. '; Modified ......: ' .. outModify .. nl
    res = res .. '; Remarks .......: ' .. outRemarks .. nl
    res = res .. '; Related .......: ' .. outRelated .. nl
    res = res .. '; Link ..........: ' .. outLink .. nl
    res = res .. '; Example .......: ' .. outExample .. nl
    res = res .. '; ' .. string.rep('=', defLineMax - 2) .. nl

    return res
end -- CreateFunctionHeader()

 

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers

I have merged the update into my version of AutoItTools.lua, and looked a the changes made and will be in the next Beta version upload soon.  tnx :) 

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

Hi Jos,

I just noticed Autocomplete sorting seems to be a little off still? I would think the short name should be at the top, no? Though I don't know if it can be improved, since lua does the sorting?

1.png.f804d9ea0c2af98289ca28ad3e27a23f.png

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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