Its time to learn about AutoIt Function Arguments. To prepare a function for input, insert some variables in between the parentheses, these will contain the input supplied, and can then be used throughout the function.
AutoIt Function Arguments Examples
Continuing the example script from the last tutorial, here is how we pass a single variable to our newly created function.
MessageFun('This is some message') Func MessageFun($Msg) MsgBox(4096, "Result", $Msg) EndFunc
Above can be used to output a message, could be a error message, or whatever you have going on.
To make the function accept multiple values, simply separate the arguments with comma.
MessageFun('Error: Unable to install file: ', '(Name of File)') Func MessageFun($Msg, $Msg2) MsgBox(4096, "Result", $Msg & $Msg2) EndFunc
Also note that we used the ampersand to join the two strings in $Msg and $Msg2, this is referred to as String Concatenation, you can read more about that in the Tutorial on AutoIt Variables.