Sign in to follow this  
Followers 0
Fabry

Variable used without being declared

19 posts in this topic

#1 ·  Posted (edited)

In a compiled script I have sometime a error says "Variable used without being declared, line:-1".

Can I have the effective number line thus I can correct it?

Edit: I forgot the maps for the server

Edited by Fabry

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]

Share this post


Link to post
Share on other sites



In a compiled script I have sometime a error says "Variable used without being declared, line:-1".

Can I have the effective number line thus I can correct it?

If we could give you the line number in a compiled script, don't you think we would do it?

At any rate, run Au3Check on your script.

Share this post


Link to post
Share on other sites

In a compiled script I have sometime a error says "Variable used without being declared, line:-1".

Can I have the effective number line thus I can correct it?

Maybe you could test the script by adding opt("mustdeclarevars",1) and then running it from scite.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Maybe you could test the script by adding opt("mustdeclarevars",1) and then running it from scite.

I did it. The error doesn't appear always, then I can't check it with scite.

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

What are you including at the top of your script? Can you at least show a snippet of code?

Edited by weaponx

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

If I know the variable, I will check it.

Sorry but the scripts are in Italian.

Client, the script where appear the error :

[autoit]#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.8.1

Author: myName

Script Function:

Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

#include<File.au3>

#include <Date.au3>

;~ #include <A3LProgress.au3>

#include <Array.au3>

#Include <GuiListView.au3>

Opt('MustDeclareVars',1)

Opt("TrayIconDebug", 1)

Dim $versione = FileGetVersion(@AutoItExe)

Dim $ips[10][100]

$ips[0][0] = 0

#region parametri socket

Dim $My_ips = StringSplit(@IPAddress1, '.')

Dim $Broadcast = $My_ips[1] & '.' & $My_ips[2] & '.' & $My_ips[3] & '.255'

UDPStartup()

TCPStartup()

dim $socket = UDPBind(@IPAddress1, 65501)

If @error <> 0 Then

MsgBox(16, 'Errore socket', 'Non

Edited by Fabry

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]

Share this post


Link to post
Share on other sites

This will get you started:

New AutoIt v3 Script.au3(57,26) : WARNING: $WM_NOTIFY: possibly used before declaration.

GUIRegisterMsg($WM_NOTIFY,

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

New AutoIt v3 Script.au3(64,70) : WARNING: $PBS_MARQUEE: possibly used before declaration.

Dim $Progress1 = GUICtrlCreateProgress(56, 256, 337, 17, $PBS_MARQUEE)

New AutoIt v3 Script.au3(97,44) : WARNING: $PBM_SETMARQUEE: possibly used before declaration.

_SendMessage($hProgress, $PBM_SETMARQUEE,

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

New AutoIt v3 Script.au3(852,37) : WARNING: $tagNMHDR: possibly used before declaration.

$tNMHDR = DllStructCreate($tagNMHDR,

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

New AutoIt v3 Script.au3(859,49) : WARNING: $LVN_COLUMNCLICK: possibly used before declaration.

Case $LVN_COLUMNCLICK ; A column was clicked

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

New AutoIt v3 Script.au3(860,51) : WARNING: $tagNMLISTVIEW: possibly used before declaration.

Local $tInfo = DllStructCreate($tagNMLISTVIEW,

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

New AutoIt v3 Script.au3(57,26) : ERROR: $WM_NOTIFY: undeclared global variable.

GUIRegisterMsg($WM_NOTIFY,

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

New AutoIt v3 Script.au3(76,80) : ERROR: _GUICtrlListView_GetColumnCount(): undefined function.

Dim $B_DESCENDING[_GUICtrlListView_GetColumnCount (GUICtrlGetHandle($ListView1))

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

New AutoIt v3 Script.au3(110,72) : ERROR: _GUICtrlListView_GetSelectedIndices(): undefined function.

If _GUICtrlListView_GetSelectedIndices (GUICtrlGetHandle($ListView1))

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

New AutoIt v3 Script.au3(111,159) : ERROR: _GUICtrlListView_GetItemText(): undefined function.

$mainSocket = TCPConnect(_GUICtrlListView_GetItemText (GUICtrlGetHandle($ListView1), _GUICtrlListView_GetSelectedIndices (GUICtrlGetHandle($ListView1)), 4)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

New AutoIt v3 Script.au3(861,101) : ERROR: _GUICtrlListView_SimpleSort(): undefined function.

_GUICtrlListView_SimpleSort ($hWndListView1, $B_DESCENDING, DllStructGetData($tInfo, "SubItem"))

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

Share this post


Link to post
Share on other sites

If we could give you the line number in a compiled script, don't you think we would do it?

Not really. There are lots of things which could be done which aren't so it's not obvious.

"Line -1" could be taken to suggest that a line number could be given, although I know @ScriptLineNumber is not relevant in a compiled script.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Not really. There are lots of things which could be done which aren't so it's not obvious.

"Line -1" could be taken to suggest that a line number could be given, although I know @ScriptLineNumber is not relevant in a compiled script.

Then quite honestly, you and anybody else who thinks we can provide the line number, but choose not to, are idiots. There is no logical (or even illogical) reason for us to keep that kind of information from you if we have it. Why anybody would think the numbers are there, we just choose not to show them is beyond my ability to fathom.

Share this post


Link to post
Share on other sites

Then quite honestly, you and anybody else who thinks we can provide the line number, but choose not to, are idiots. There is no logical (or even illogical) reason for us to keep that kind of information from you if we have it. Why anybody would think the numbers are there, we just choose not to show them is beyond my ability to fathom.

Thanks for your flattering references to my intellectual capabilities.

However, I didn't say that I thought you could provide line numbers and whether I did or not then saying that anyone who thinks so is an idiot is quite uncalled for. I'm a mechanical designer so why should I be expected to know all about something that you're a specialist in anyway? You might, for example, ask me for a metric ball bearing and I would not say you're an idiot just because you don't know that ball bearings are only made in imperial dimensions. I would on the other hand explain why you couldn't have one.

It does not seem unreasonable to me that someone should think line numbers could be given. In fact I would say that if you were prepared to bloat the code and make it less efficient then it could definitely be done. Your statement that if it could be done then it would have been done is simply not true. If something could be done then it would have been done is obviously not the case or there would be nothing left to do to improve AutoIt.

I also pointed out that since the error message includes "Line -1" then it would be understandable for someone to think that line numbers could be given. It could be arranged that the meaningless message is not given but it hasn't been done.

Because a feature is missing people will not assume that you have chosen not to give it.

I and many other people appreciate your contribution to AutIt Valik, and we have great respect for your abilities. If you yourself were able to recognize that you have an unusual ability then you might to able to treat people without the same abilities or knowledge a little more gently.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

too difficult。

看不明白啊 郁闷

Share this post


Link to post
Share on other sites

Thanks for your flattering references to my intellectual capabilities.

However, I didn't say that I thought you could provide line numbers and whether I did or not then saying that anyone who thinks so is an idiot is quite uncalled for. I'm a mechanical designer so why should I be expected to know all about something that you're a specialist in anyway?

Common sense is not a specialty, although it seems to be that it's less common than it's name implies. It seems to me that pausing for a moment and thinking about the problem will yield at least an answer along the lines "Hmm, I bet they can't for some reason".

It does not seem unreasonable to me that someone should think line numbers could be given. In fact I would say that if you were prepared to bloat the code and make it less efficient then it could definitely be done. Your statement that if it could be done then it would have been done is simply not true. If something could be done then it would have been done is obviously not the case or there would be nothing left to do to improve AutoIt.

This is merely a technicality. My response is simply, nothing is impossible, only temporarily unavailable, so anytime anybody ever says "something can't be done" they are "lying" as you say. So my response as I originally made it is still correct when taken in context. We can't because we don't have line numbers because it would add bloat that's not worth adding for such a minor thing.

I also pointed out that since the error message includes "Line -1" then it would be understandable for someone to think that line numbers could be given. It could be arranged that the meaningless message is not given but it hasn't been done.

The same reason you mentioned before. Bloat. It requires us to duplicate several messages, all error messages added in the future will need 2 versions and there has to be special code to load the right error message.

Because a feature is missing people will not assume that you have chosen not to give it.

They would if they'd stop for a minute to think, "Why wouldn't they give us this feature when it's already implemented for non-compiled scripts unless it's not as easy as it seems?"

You might, for example, ask me for a metric ball bearing and I would not say you're an idiot just because you don't know that ball bearings are only made in imperial dimensions. I would on the other hand explain why you couldn't have one.

At this point, I'd stop and you tell you I don't particularly give a rats ass that the ball bearing conforms better to imperial dimensions and that I needed one for my needs to fit a size I had only in metric. Convert my size to imperial if you must or convert the imperial size to metric and find the best ball bearing closest to what I need and spare me the misleading lecture about how an object created using one measurement standard is somehow magically incompatible with another standard. Things don't work perfect when converting standards, but they do work. So your argument here seems a bit out of place and doesn't work as well as you had hoped.

All this comes down to people need to stop and think on their own for a time instead of just rushing off to ask questions that have obvious answers. And I don't think my "specialization" on the subject has anything to do with my ability to see the answer.

Share this post


Link to post
Share on other sites

Common sense is not a specialty, although it seems to be that it's less common than it's name implies. It seems to me that pausing for a moment and thinking about the problem will yield at least an answer along the lines "Hmm, I bet they can't for some reason".

This is merely a technicality. My response is simply, nothing is impossible, only temporarily unavailable, so anytime anybody ever says "something can't be done" they are "lying" as you say. So my response as I originally made it is still correct when taken in context. We can't because we don't have line numbers because it would add bloat that's not worth adding for such a minor thing.

The same reason you mentioned before. Bloat. It requires us to duplicate several messages, all error messages added in the future will need 2 versions and there has to be special code to load the right error message.

They would if they'd stop for a minute to think, "Why wouldn't they give us this feature when it's already implemented for non-compiled scripts unless it's not as easy as it seems?"

At this point, I'd stop and you tell you I don't particularly give a rats ass that the ball bearing conforms better to imperial dimensions and that I needed one for my needs to fit a size I had only in metric. Convert my size to imperial if you must or convert the imperial size to metric and find the best ball bearing closest to what I need and spare me the misleading lecture about how an object created using one measurement standard is somehow magically incompatible with another standard. Things don't work perfect when converting standards, but they do work. So your argument here seems a bit out of place and doesn't work as well as you had hoped.

All this comes down to people need to stop and think on their own for a time instead of just rushing off to ask questions that have obvious answers. And I don't think my "specialization" on the subject has anything to do with my ability to see the answer.

Thanks for the reply Valik, I don't have much to disagree with you there.

My argument wasn't out of place but maybe you misunderstood. The only reason I mentioned ball bearings was that it is something that most people wouldn't know but it's obvious to me. A ball bearing is the ball that you find in most bearings. The bearing can be any size, metric or imperial but the balls, ie the ball bearings, are only ground to imperial sizes the whole world over. You cannot get a 10mm ball bearing but you can get 3/8", 1/2" etc.

I appreciate that you don't give a rat's ass about it and the point is that you don't need to, but it is something that was presumably not obvious to you, but to me it's common sense, and things that are obvious to you might appear to be common sense but as you say, are probably not.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

@Valik - I feel like you resort to making us feel inferior to make a point, and as a big contributor I feel like you aren't giving us the benefit of the doubt. You did the same thing to me here: http://www.autoitscript.com/forum/index.ph...57&hl=valik

All martin was saying is that just because a feature CAN be added to AutoIt doesn't mean it would be efficient and bug-free. You responded like he said "developers have the ability to show the line number in a compiled script and are just maliciously withholding it", but thats not how I interpreted it all.

Share this post


Link to post
Share on other sites

you aren't giving us the benefit of the doubt.

It's funny you say that. I almost said the exact same thing in reverse. Give us (the developers) the benefit of the doubt that if we could do something (correctly), we would.

Share this post


Link to post
Share on other sites

@Valik - I feel like you resort to making us feel inferior to make a point, and as a big contributor I feel like you aren't giving us the benefit of the doubt. You did the same thing to me here: http://www.autoitscript.com/forum/index.ph...57&hl=valik

All martin was saying is that just because a feature CAN be added to AutoIt doesn't mean it would be efficient and bug-free. You responded like he said "developers have the ability to show the line number in a compiled script and are just maliciously withholding it", but thats not how I interpreted it all.

Thanks for your understanding weaponx. I wouldn't generally encourage other people to join this sort of thing, but on the other hand they can be quite good fun.

Here's one of my fond memories.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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