Jump to content

Recommended Posts

Posted

whenever i run my script, SCITE pretty much wants me to global every variable, why does it do this?

I can still run it, I just don't like seeing all the warnings.

  • Developers
Posted (edited)

whenever i run my script, SCITE pretty much wants me to global every variable, why does it do this?

I can still run it, I just don't like seeing all the warnings.

SciTE doesn't want anything but when you use SciTe4AutoIt3 then AU3Check is run before running your script with AutoIt3.exe to tell you about syntax errors and possible problems in your script. It is very likely your coding habits that cause au3check to generate the warnings, but you have to give an example to see what really is happening.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

I ran something like this, and its giving me 2 warnings

E\test.au3(9,33) : WARNING: $Main possibly not declared/created yet

$Main = GUICreate("", 225, 180)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

E:\test.au3(13,20) : WARNING: $msg possibly not declared/created yet

$msg = GUIGetMsg()

~~~~~~~~~~~~~~~~~~^

E:\test.au3 - 0 error(s), 2 warning(s)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiRichEdit.au3>
#Include <GuiEdit.au3>
#include <SliderConstants.au3>
#include <Array.au3>


$Main = GUICreate("",  225, 180)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    EndIf
WEnd
Posted

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "E:\test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>17:49:24 Starting AutoIt3Wrapper v.2.0.0.1 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 2 CPU:X64 OS:X86)

>Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3

E:\test.au3(9,33) : WARNING: $Main possibly not declared/created yet

$Main = GUICreate("", 225, 180)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

E:\test.au3(13,20) : WARNING: $msg possibly not declared/created yet

$msg = GUIGetMsg()

~~~~~~~~~~~~~~~~~~^

E:\test.au3 - 0 error(s), 2 warning(s)

->17:49:24 AU3Check ended.rc:1

>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "E:\test.au3"

+>17:49:29 AutoIT3.exe ended.rc:0

+>17:49:30 AutoIt3Wrapper Finished

>Exit code: 0 Time: 8.615

  • Developers
Posted (edited)

It looks like au3check is triggered with the -d parameter or detect an OPT() statement.

do you have this line in one of the used Included files? :

Opt("MustDeclareVars", 1)
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

yea i found it in GUIRichEdit.au3

Global $_GRE_oldMustDeclareVars = Opt("MustDeclareVars", 1)

Opt("MustDeclareVars", $_GRE_oldMustDeclareVars)

has those 2 lines, so i guess i am stuck with it :)

EDIT: i took it out and it still works :), problem solved, thanks

Edited by d0n
Posted (edited)

Opt("MustDeclareVars", 1) is a good thing.

Yuu don't have to use Global, you can use Local but you have to understand the scope when using functions. Local $Main = GUICreate("", 225, 180) would cause no errors in the script shown.

Edited by bo8ster

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...