Sign in to follow this  
Followers 0
Akshay07

Difference between _Myfunction($parm) and Call("MyFunction", $parm)?

9 posts in this topic

All in the title..

Any difference between

_Myfunction($parm)

and

Call("MyFunction", $parm)?

thanks

A.

Share this post


Link to post
Share on other sites



Well, with all due respect, if I am asking, it's because I don't now :D

I would tend to think that there are no difference, except maybe how fast the instruction is run, but this is just a guess. That is mostly why I am asking, I did not manage to find any answer in the autoit help or in this forum (which does not mean that it is not there, I might just have used the wrong keywords).

Share this post


Link to post
Share on other sites

Simple rule of thumb is never to use Call() unless you need to perform a Func of which the name is the value of a variable.

So, yes they are the same but don't use Call().

Jos


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

Thanks Jos, I did not know that. I appreciate very much your input.

I just checked the "autoit" help for "´Functions" and this is not at all mentioned.

I will update my scripts according to your comment.

Share this post


Link to post
Share on other sites

The helpfile does mention it "somewhat" in the page about Call().

Call

--------------------------------------------------------------------------------

Calls a user-defined function contained in a string parameter.


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

#7 ·  Posted (edited)

If I may give a constructive comment, this is not very clear :D

It is not mentioned that it is better to use something like _Myfunction($parm)

This is not at all a complain, I absolutely love AutoIt and I cannot thank enough all of those who contributed to make this tool so great. I don't know any other free program for Window that is as powerful as AutoIt. And I also cannot thank enough the AutoiIt community here for helping us out so much.

Edited by Akshay07

Share this post


Link to post
Share on other sites

Ashkay07,

this is not very clear

Nothing personal, but the Help file describes Call quite clearly:

Call - Calls a user-defined function contained in a string parameter

And the overwhelming majority of examples in the Help file use this form of function call:

_Main()

Func _Main()

So it requires a real effort to decide to use Call as a default for calling functions. However, you are not entirely alone as we do get the odd query about it - and that is not playing with words before you ask! :D

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

#9 ·  Posted (edited)

M23,

You are right.

Thanks to Jos and you for your answers.

Edited by Akshay07

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
Sign in to follow this  
Followers 0