Sign in to follow this  
Followers 0
dbzfanatic

Reference custom functions from a different au3 file

7 posts in this topic

Is there a certain syntax I need to follow for functions that aren't in the same au3 file as the program that uses them? They work perfectly inside the same au3 file but when I move them to their own they don't show up like _IECreate or _ArrayDisplay or GUICtrlRead or any other pre-made functions. What am I doing wrong?

Share this post


Link to post
Share on other sites



What do you mean they don't show up?

Save as Include.au3:

Func TestMe()
  MsgBox(0, '', 'Test')
EndFunc

Save as Test.au3

#include "Include.au3"
TestMe()

Make sure they're both in the same folder and run Test.au3.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Both au3 files are in the same folder and what I mean is that normally when you start to type a function autocomplete gives a list of recomendations and when you're done typing the function turns blue, that doesn't happen with mine.

Edit: I know one of you is going to ask for the error given and it's "Undefined Function"

Edited by dbzfanatic

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Both au3 files are in the same folder and what I mean is that normally when you start to type a function autocomplete gives a list of recomendations and when you're done typing the function turns blue, that doesn't happen with mine.

Edit: I know one of you is going to ask for the error given and it's "Undefined Function"

Heres an example of what the Main file and the Second(File with ur functions) would look like. Put them in same folder

Hope this helps

Main.au3

#include <Second.au3>
_NewFunc()

Second.au3

#include-once
#region _New
Func _NewFunc()
      Test
EndFunc
#endregion
Edited by frostfel

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

:) I think I forgot to put the #endregion in the 2nd au3 file w/ the acutal functions...

Edit: nope, just tried it, still getting that freaking "Undefined Function" error.

Edit to the Edit: sorry, it does work I forgot to reinclude the 2nd au3 file too :) man I'm out of it today. Thanks a lot guys/girls.

Edited by dbzfanatic

Share this post


Link to post
Share on other sites

:) I think I forgot to put the #endregion in the 2nd au3 file w/ the acutal functions...

Yeah I forget sometimes too dont forget to start the region also exp. #region _New


Share this post


Link to post
Share on other sites

??? Regions don't actually do anything. They're only used with Scite. They don't have any real impact on AutoIt code, they're just for organizational purposes.

Just try running this code:

#endregion
msgbox(0,0,'hi there')
#endregion
#region

And you'll see that nothing strange happens.

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