Sign in to follow this  
Followers 0
LineageIIC3Freak

Running One Au3 From Another

5 posts in this topic

Ok I've got a little problem.... Everytime I try to #include an .au3 within a function it tells me that the .au3 that im trying to include is missing and EndFunc within it somewhere. Now I know its not because i've checked it over and over and the .au3 will run by itself, but whenever I have it run from another .au3 that error pops up on me.

Here's Code to the .au3 that is supposed to run another one.

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
$GSmenu = GUICreate("Grade Selection", 500, 100)
$AGrade = GUICtrlCreateButton("A Grade", 5, 35, 60)
GUICtrlSetOnEvent($AGrade, "AGrade")
$BGrade = GUICtrlCreateButton("B Grade", 65, 35, 60)
$CGrade = GUICtrlCreateButton("C Grade", 125, 35, 60)
$DGrade = GUICtrlCreateButton("D Grade", 185, 35, 60)
$NGrade = GUICtrlCreateButton("E Grade", 245, 35, 60)

GUICtrlCreateLabel("- Choose a Grade", 310, 45)
GUISetState()

While 1
 Sleep(1)
WEnd

Func AGrade()
GUIDelete($GSmenu)
#include <A Grade.au3>
EndFunc

Now all this code is for making an Item Guide for the game LineageII if you are curious about the "A Grade/B Grade/Etc"

And heres the code for the .au3 its trying to open

;***************************************************************************************************

*************************
;*                                  }       LineageII Info Shack v1.0.0    {                                          *
;***************************************************************************************************

*************************
;*   /^\ S   ___    (                                       )   /^\ S    ___          *
;*   `_/  E   |_      )   This Program Was Created By: 2SEX-E w/ The Help Of AutoItv3     ( `_/  E   |_         *
;*   /__   X  |___  (                                       )   /__   X  |___       *
;***************************************************************************************************

*************************

;-------------
;GUI Section |
;***************************************************************************************************

*************************
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
GUICreate("Main Menu", 400, 200)
GUISetBkColor(0x010101)
GUISetState()


;----------------
;Weapons Section|
$WeapMenu = GUICtrlCreateMenu("Weapons")
$Sword = GUICtrlCreateMenuItem("Swords", $WeapMenu)
GUICtrlSetOnEvent($Sword, "Swords")
GUICtrlCreateMenuItem("Bows", $WeapMenu)
GUICtrlCreateMenuItem("Blunts", $WeapMenu)
GUICtrlCreateMenuItem("Spears", $WeapMenu)
GUICtrlCreateMenuItem("Staves", $WeapMenu)
GUICtrlCreateMenuItem("Duals", $WeapMenu)
GUICtrlCreateMenuItem("Etc", $WeapMenu)


;--------------
;Armor Section|
$ArmMenu = GUICtrlCreateMenu("Armors")
GUICtrlCreateMenuItem("Heavy Armor", $ArmMenu)
GUICtrlCreateMenuItem("Light Armor", $ArmMenu)
GUICtrlCreateMenuItem("Robes", $ArmMenu)
GUICtrlCreateMenuItem("", $ArmMenu, 3)
GUICtrlCreateMenuItem("Hvy Arm Sets", $ArmMenu)
GUICtrlCreateMenuItem("Lt Arm Sets", $ArmMenu)
GUICtrlCreateMenuItem("Robe Sets", $ArmMenu)


;-----------------
;Jewelery Section|
$JewlMenu = GUICtrlCreateMenu("Jewelery")
GUICtrlCreateMenuItem("Necklaces", $JewlMenu)
GUICtrlCreateMenuItem("Earrings", $JewlMenu)
GUICtrlCreateMenuItem("Rings", $JewlMenu)


;-------------
;Help Section|
$HelpMenu = GUICtrlCreateMenu("Help")
$AboutMenu = GUICtrlCreateMenuItem("About L2 I.S.", $HelpMenu)
GUICtrlSetOnEvent($AboutMenu, "AboutThis")
GUICtrlCreateMenuItem("Contact Info", $HelpMenu)
;***************************************************************************************************

*************************

;-------------
;Wait Section|
;***************************************************************************************************

*************************
Do
  $msg = GUIGetMsg ()
     
Until $msg = $GUI_EVENT_CLOSE
;***************************************************************************************************

*************************

;***************************************************************************************************

*************************
;-------------
;Help - About|
Func AboutThis()
   GUICreate("About 2nd Hand", 300, 200, -1, -1)
   $label2 = GUICtrlCreateLabel("This program was created for the people that do not want to access false websites for this info and/or wanted the most updated information.", 5, 5, 190, 50)
   $label1 = GUICtrlCreateLabel("Made By 2Sex-E and Associates", 5, 150)
   $Back = GUICtrlCreateButton("Back", 120, 170, 60, 20, $BS_BITMAP)
   GUICtrlSetImage ( $Back, "C:\Documents and Settings\2Sex-E\Desktop\L2Info\Pictures\BackButton.gif")
   GUICtrlSetOnEvent( $Back, "GoBack")
   GUICtrlCreatePic("C:\Documents and Settings\2Sex-E\Desktop\L2Info\Pictures\Author.gif", 5, 60, 290, 80)
   GUISetBKColor(0x000000)
   GUICtrlSetColor($label1, 0xffffff)
   GUICtrlSetColor($label2, 0xffffff)
   GUISetState()
EndFunc

Func GoBack()
   GUIDelete()
EndFunc
;***************************************************************************************************

*************************

Func Swords()
   #Include <Swords.au3>
EndFunc

And when I start the 1st .au3 I get an error before anything happends saying

Line 72 (File"C:\Documents and Settings\2Sex-E\Desktop\A Grade.au3"):

Func AboutThis()

Error: "Func" statement has no matching "EndFunc".

So if anyone that knows what the heck the problem is with this please reply to this or you can contact me by email at StraightPimpin9008@yahoo.com or you can im me at Dai3itchCrushaCB on aol instant messenger. Thank You.

[quote]I don't like to think, Therefore I ChEaT[/quote]

Share this post


Link to post
Share on other sites



Have you made all the #include <.au3> into operable UDF's and put them in the include folder?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

I don't know if i made them "operable UDF's", but they don't need to be in a folder. No matter the location i still get the same exact error...


[quote]I don't like to think, Therefore I ChEaT[/quote]

Share this post


Link to post
Share on other sites

You cannot have a Func-EndFunc within a Func..

In other words: when your included file contains a Func it has to be include outside of a Func...EndFunc


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I gotcha, thanks. I just made a .au3 with a GUI that has a button to run both .au3's and it had HotKeySet() to stop them if needed and I took out the Func() EndFunc's out of the others.


[quote]I don't like to think, Therefore I ChEaT[/quote]

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