mrider Posted December 24, 2014 Share Posted December 24, 2014 (edited) Greetings: I am messing around with the new map behavior in the beta. Specifically I am running the code found in post #5 here -> '?do=embed' frameborder='0' data-embedContent>> Although that code works, "Syntax Check Beta" fails the code at the point where I simulate an object. So I guess my question is this: Is my syntax "illegal but it happens to work"? Or is it legal but the syntax check program simply hasn't been updated yet? Or finally should I be doing this a different way? Code here again so you don't have to follow a link: #include <MsgBoxConstants.au3> Local $aObjs[2] = [NewFoo(), NewBar()] For $i = 0 To UBound($aObjs) - 1 Local $sMsg = ($aObjs[$i].Output)() ; <-- This line of code is flagged as a syntax error MsgBox($MB_SYSTEMMODAL, "Test", $sMsg) Next Func NewFoo() Local $mPseudoObj[] $mPseudoObj["Output"] = FooOutput Return $mPseudoObj EndFunc Func FooOutput() Return "Foo" EndFunc Func NewBar() Local $mPseudoObj[] $mPseudoObj["Output"] = BarOutput Return $mPseudoObj EndFunc Func BarOutput() Return "Bar" EndFunc [EDIT] Corrected minor stupidity on my part in the code... Edited December 24, 2014 by mrider How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
BrewManNH Posted December 24, 2014 Share Posted December 24, 2014 That code won't run with the beta even if you turn off the Au3Check. I get this when I run it. Unbalanced brackets in expression.: Local $sMsg = ($aObjs[$i]).Output)() Local $sMsg = ^ ERROR If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
mrider Posted December 24, 2014 Author Share Posted December 24, 2014 (edited) Sorry, copy/paste problem. That line of code should be: Local $sMsg = ($aObjs[$i].Output)() [EDIT] Perhaps I should add that the syntax error to which I referred was not the syntax error BrewManNH kindly pointed out. The error trace in SciTE after running beta syntax check looks like this: >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:Shared_DatascriptsAutoIttemp.au3" /UserParams +>09:20:55 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:Program Files (x86)AutoIt3SciTE UserDir => C:Program Files (x86)AutoIt3SciTEAutoIt3Wrapper >Running AU3Check (3.3.12.0) from:C:Program Files (x86)AutoIt3 input:C:Shared_DatascriptsAutoIttemp.au3"C:Shared_DatascriptsAutoIttemp.au3"(6,38) : error: syntax error Local $sMsg = ($aObjs[$i].Output)( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:Shared_DatascriptsAutoIttemp.au3 - 1 error(s), 0 warning(s) !>09:20:55 AU3Check ended. Press F4 to jump to next error.rc:2 +>09:20:56 AutoIt3Wrapper Finished. >Exit code: 2 Time: 0.554 Edited December 24, 2014 by mrider How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 24, 2014 Developers Share Posted December 24, 2014 It is correct that au3check not all Beta syntax supports. there is another one open which is similar to this one. https://www.autoitscript.com/trac/autoit/ticket/2822 I haven't felt the urge for a while to open the sourcecode and start debugging. 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. Link to comment Share on other sites More sharing options...
mrider Posted December 24, 2014 Author Share Posted December 24, 2014 Fair enough. Thanks!! How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
mrider Posted December 26, 2014 Author Share Posted December 26, 2014 (edited) I have a follow-up question: Is it possible to disable the syntax check that runs in SciTE for beta code? I would even be willing to live without the syntax check for all code if I can put it back with (relative) ease. I find that being forced to run the code from a right-click is tedious. I would be willing to live without the syntax check in order to have the capability of using F5, the console, and the other nice things SciTE brings... Edited December 26, 2014 by mrider How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 26, 2014 Moderators Share Posted December 26, 2014 mrider,Add #AutoIt3Wrapper_Run_AU3Check=n to the top of the script. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mrider Posted December 26, 2014 Author Share Posted December 26, 2014 Perfect! Thanks!! How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
mrider Posted January 7, 2015 Author Share Posted January 7, 2015 Just for laughs, I more or less wrote the SimuDuck that's on page 22 of Head First Design Patterns in pseudo OO AutoIt. As you can see, we can't do full-blown OO, but we can do more-or-less duck type OO reasonably well. It's a little weird having to send the object instance as the first parameter of the calls, but anybody that's programmed in Perl or Python (or ??) will not be too upset about receiving the instance in the function. I say this again, I can't freaking wait until this hits production! Be sure to run this with the Beta build... expandcollapse popup#AutoIt3Wrapper_Run_AU3Check=n ; More or less demonstrates the SimuDuck on page 22 of Head First Design Patterns ; First we do a bit of OO work Local $ducks[3] = [NewMallardDuck(), NewRubberDucky(), NewHuntingDecoy()] For $i = 0 To UBound($ducks) - 1 ($ducks[$i].ShowType)($ducks[$i]) ($ducks[$i].Fly)() ($ducks[$i].Quack)() ConsoleWrite(@LF & @LF) Next ; Now, we create a home-made duck using, ahem, duck typing Local $myduck = NewBaseDuck() ; Oops, looks like I forgot something... ($myduck.ShowType)($myduck) ($myduck.Fly)() ($myduck.Quack)() ConsoleWrite(@LF & @LF) ; There - that's better... :) ($myduck.SetType)($myduck, "Home made duck") ($myduck.SetFlyBehavior)($myduck, FlyRocketPowered) ($myduck.SetQuackBehavior)($myduck, Squeek) ($myduck.ShowType)($myduck) ($myduck.Fly)() ($myduck.Quack)() ConsoleWrite(@LF & @LF) #Region Base Duck Behavior Func NewBaseDuck() Local $self[] $self["Type"] = "Abstract Base Duck" $self["SetType"] = SetType $self["ShowType"] = ShowType $self["SetFlyBehavior"] = SetFlyBehavior $self["SetQuackBehavior"] = SetQuackBehavior $self["Fly"] = BaseDuckFly $self["Quack"] = BaseDuckQuack Return $self EndFunc Func SetType(ByRef $self, Const $type) $self["Type"] = $type EndFunc Func ShowType(Const ByRef $self) ConsoleWrite($self.Type & @LF) EndFunc Func SetFlyBehavior(ByRef $self, Const $func) $self["Fly"] = $func EndFunc Func BaseDuckFly() ConsoleWrite("(No behavior set)" & @LF) EndFunc Func BaseDuckQuack() ConsoleWrite("(No behavior set)" & @LF) EndFunc Func SetQuackBehavior(ByRef $self, Const $func) $self["Quack"] = $func EndFunc #EndRegion #Region Mallard Duck Func NewMallardDuck() Local $self = NewBaseDuck() $self["Type"] = "Mallard Duck" $self["Fly"] = FlyWithWings $self["Quack"] = Quack Return $self EndFunc #EndRegion #Region Rubber Ducky Func NewRubberDucky() Local $self = NewBaseDuck() $self["Type"] = "Rubber Ducky" $self["Fly"] = FlyNoWay $self["Quack"] = Squeek Return $self EndFunc #EndRegion #Region Hunting Decoy Func NewHuntingDecoy() Local $self = NewBaseDuck() $self["Type"] = "Hunting Decoy" $self["Fly"] = FlyNoWay $self["Quack"] = MuteQuack Return $self EndFunc #EndRegion #Region Fly Behaviors Func FlyWithWings() ConsoleWrite("Flap, flap, flap wings..." & @LF) EndFunc Func FlyNoWay() ConsoleWrite("(I can't fly...)" & @LF) EndFunc Func FlyRocketPowered() ConsoleWrite("I'm flying with a rocket!" & @LF) EndFunc #EndRegion #Region Quack Behaviors Func Quack() ConsoleWrite("Quack, quack" & @LF) EndFunc Func Squeek() ConsoleWrite("Squeek, sqeek" & @LF) EndFunc Func MuteQuack() ConsoleWrite("(I make no sounds...)" & @LF) EndFunc #EndRegion How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now