Jump to content

Question on Includes


 Share

Recommended Posts

hi there i have a nice little script that runs fine but i want to add something to it but after adding an include am getting an error ERROR: $WM_COMMAND previously declared as a 'Const', im not declaring this constant so i checked my includes and found out that both WindowsConstants.au3 and GUIInputSetOnlyNumbers.au3(made by MrCreatoR) are declaring this variables could this the cause of the error, any thought/comments on this?

Work smarter not harder.My First Posted Script: DataBase

Link to comment
Share on other sites

yes it is $WM_COMMAND are defined inside both WindowsConstants.au3 and GUIInputSetOnlyNumbers.au3, so you were saying that its ok that 2 include udfs contain Global Const $WM_COMMAND = 0x0111 and that the problem is with my script...hmmmm... will try to look into this Thanks for the reply, i just needed to know if its ok to have 2 udfs declare the same constant. Thanks again

Work smarter not harder.My First Posted Script: DataBase

Link to comment
Share on other sites

Thanks Hannes123

But i have set windowsconstants.au3 first before GUIInputSetOnlyNumbers.au3 but still have the same result, even tried to interchange their position. i made a copy of GUIInputSetOnlyNumbers.au3 udf and modified itself, removed the const $WM_COMMAND and made another include this time on the modified udf. this one worked for me but i dont think this is a good idea specialy with the one who created the udf :)

Work smarter not harder.My First Posted Script: DataBase

Link to comment
Share on other sites

FMPOV, the order of includes doesn't matter. On runtime/compile the whole code consits all lines of all au3 files.

You cannot declare a const value twice.

Just delete the declaration in the GUIInputSetOnlyNumbers UDF and include the standard UDF.

When compiling use the obfuscator with e.g. striponly to get rid of unneeded lines of code.

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Ok Thanks Hannes123 for the help

#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIInputSetOnlyNumbers.au3>

GUICreate("Sample Only", 130, 140, Default, Default, $WS_CAPTION)
GUICtrlCreateLabel ("Code1",10,10)
$Lcode = GUICtrlCreateInput("", 80, 5, 40, 20)
GUICtrlSetLimit($Lcode,3)
GUICtrlCreateLabel ("Code2",10, 30)
$Scode = GUICtrlCreateInput("", 80, 25, 40, 20,$ES_UPPERCASE)
GUICtrlSetLimit($Scode,2)
GUICtrlCreateLabel ("Year",10, 50)
$SYear = GUICtrlCreateInput(@YEAR, 80, 45, 40, 20)
_GuiInputSetOnlyNumbers($SYear)
GUICtrlSetLimit($SYear,4)
GUICtrlCreateLabel ("Month",10, 70)
$SMonth = GUICtrlCreateCombo("", 45, 65, 75, 20,$CBS_DROPDOWNLIST)
$Month = 'March'
GUICtrlSetData($SMonth, "1 Year|January|February|March|April|May|June|July|August|September|October|November|December", $Month)
GUISetState()
$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
WEnd

here i made a sample modified from my script, well its not only $WM_COMMAND but also $WM_MOVE, $WM_LBUTTONDOWN, $WM_RBUTTONDOWN all 4 const are declared at windowsconstants.au3 and GUIInputSetOnlyNumbers.au3

Edited by Ace08

Work smarter not harder.My First Posted Script: DataBase

Link to comment
Share on other sites

Thanks Xenobiologist

i did try that one and its working realy nice. its just that i think its not right to modify udfs in respect with the maker so i was trying to see if there are other solutions.

Thanks guys for the help

Work smarter not harder.My First Posted Script: DataBase

Link to comment
Share on other sites

That's life. Things are changing and not always the UDFs are changed too.

I think, it is no problem to delete those varibles.

Good luck!

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
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
 Share

  • Recently Browsing   0 members

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