AutoIt v3 General Help and Support

Asked By 0 points N/A Posted on -
qa-featured

Hi experts,

After installation of AutoIt this error appeared when I tried to open Help and Support of the program. This error closed the program. Generally AutoIt is working just fine and until now this is the only error appeared. Does anyone have any idea about this error ?

Thank you !

AutoIt error

Line 18 (File “C:UsersDJDesktopTest.au3”):

Func “ _Test” ($Test)

Error: Badly formatted “Func” statement.

SHARE
Answered By 590495 points N/A #179543

AutoIt v3 General Help and Support

qa-featured

I think the problem here is not with AutoIt if you say it is a fresh install. I guess you loaded an AU3 file after installing AutoIt that made the error to appear. If this is the case, check line number 18 because AutoIt reported that the “func” statement is badly formatted. If you want to use a function statement in your script then you should know the proper way of declaring it.

A function is a segment of code that can be called from the script that will execute a specific function or task. There are two kinds of functions in AutoIt, first the built-in functions and second, the user functions. Also remember that functions or function names are case insensitive. For example, “msgbox()” is the same or read as “MsgBox()”.

A user function is declared using Func.. EndFunc statements. Check the sample script below.

  • #include <constants.au3></constants.au3>

 

  • Local $iNumber = 10
  • Local $iDoubled = 0

 

  • For $i = 1 To 10
  •  $iDoubled = MyDouble($iNumber)
  •  MsgBox($MB_OK, "", $iNumber & " doubled is " & $iDoubled)
  •  $iNumber = $iDoubled
  • Next
  • Exit

 

  • Func MyDouble($iValue)
  •  $iValue = $iValue * 2
  •  Return $iValue​
  • EndFunc ;==>MyDouble

Related Questions