Modify

#4066 new Bug

OnAutoItStartRegister Example fails

Reported by: donnyh13 Owned by:
Milestone: Component: AutoIt
Version: 3.3.18.0 Severity: None
Keywords: Cc:

Description

The help file for OnAutoItStartRegister states:

As the function runs before any of the main script code is executed, the function cannot reference any variables defined in an #include nor any variables defined as Global within the script. All variables within the function are treated as Local.

Yet the example for OnAutoItStartRegister does this very thing,

#include <MsgBoxConstants.au3>

; Register Example() and SomeFunc() to be called when AutoIt starts.

#OnAutoItStartRegister "Example"
#OnAutoItStartRegister "SomeFunc"

Sleep(1000)

Func Example()
        MsgBox($MB_SYSTEMMODAL, "", "Function 'Example' is called first.")
EndFunc   ;==>Example

Func SomeFunc()
        MsgBox($MB_SYSTEMMODAL, "", "Function 'SomeFunc' is called second.")
EndFunc   ;==>SomeFunc

MsgBox($MB_SYSTEMMODAL,

Of course the example fails with:

"C:\Program Files (x86)\AutoIt3\Examples\Helpfile\OnAutoItStartRegister.au3" (11) : ==> Variable used without being declared.:
MsgBox($MB_SYSTEMMODAL, "", "Function 'Example' is called first.")
MsgBox( ERROR

Attachments (0)

Change History (0)

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.