cres

Get required/optional parameters of a function

8 posts in this topic

#1 ·  Posted (edited)

Hi!

Is there any function in Autoit that gets the number of required/optional parameters of a function (just like how SciTE does it)

_TestFunction("param1")

Func _TestFunction($p1, $p2, $p3, $p4, $p5)

EndFunc

When you run the code above, SciTE determines that I called the function with 1 arg but 5 are required (image reference below). Is there a way I could do this or at least could you point me to the right path?

Thanks!

error_ref.png

Edited by cres

Share this post


Link to post
Share on other sites



cres,

As you have the function code in your script, surely you already know the number of required/optional parameters?

You can very easily add UserCallTips (the popup that SciTE produces when you enter a function name) for your most commonly used functions using the CallTipManager available in the full SciTE4AutoIt3 package (as well as getting lots of other utilities to help you code in AutoIt).

M23

1 person likes this

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

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi Melba23,

Thanks a lot for your reply!

I'm actually interested to know how SciTE does this (determining how many parameters should I pass to a function call)

or what's the algorithm for this?

Thanks!

Share this post


Link to post
Share on other sites

cres,

I think it is Au3Check that does that particular piece of magic - I will point Jos here as in either case he is the man to answer.

M23


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

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

@cres, You are getting that inline error only when you perform Run/Compile or Check on your source. YOu will see in the SciTE output pane the very same information during the execution of au3check, which is interpreted by SciTE and shown in-line.

So it is indeed au3check that does the lexing and checking.

Jos

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Hi Jos,

Thanks for the clarification about au3check!

Share this post


Link to post
Share on other sites

Maybe you could be interested also on this post by mLipok,   where all functions of a script ar enumerated within an array and one column of the array contains parameters required by each function

 

 

 

1 person likes this

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Hi Chimp,

That's actually a great function and it shows the algorithm I was looking for.

Thanks for the link!

Share this post


Link to post
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