Sign in to follow this  
Followers 0
AliceDemetri

[Solved] Unknown function name, function in external udf.

8 posts in this topic

#1 ·  Posted (edited)

Solved: The include that I was writing had the same name as one of the ones provided with autoit so autoit was using the one it provided instead of mine. Simple name change fixes this problem.

I'm creating a script which uses a function in an external udf. When I copy the function to the original script it runs fine but when I cut and paste it into the udf it doesn't find the function name. I have included the file and check my syntax, even copy and pasted the simple filename to make sure it wasn't a type. Is there any other reason this error would show up? My script is uncompiled at the moment.

Edit: Solved

Edited by AliceDemetri

Share this post


Link to post
Share on other sites



There may be several functions called from the one that you are calling from the UDF.  It is best to include the whole UDF to acquire the one function that you want.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I didn't explain well. The function was originally in my running script. I copied the function (along with the rest of the udf that was copied to the bottom of the script) and pasted it into a new script. Included that and the function is unrecognized for some reason. So I am including the whole udf just instead of being at the bottom of my script it's a separate one now. I've worked with autoit for years I'm sure it's something stupid but I can't figure out why it's not including this function.

I'd post the script but it's a child script with variables passed from a mother process and it's pretty glitchy at the moment. but basically I have two files:

Script.au3 And Include.au3.

When setup like the fallowing it works

 Script:

 
_Hello()
 
Func _Hello()
MsgBox(0,'','Hello World')
EndFunc

But when it's setup like this it doesn't:

Script:

#include <Include.au3>
 
_Hello()

Include:

Func _Hello()
MsgBox(0,'','Hello')
EndFunc
Edited by AliceDemetri

Share this post


Link to post
Share on other sites

When you run the script, does it find your include file? Or do you get an error stating file can't be found?


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 Gude
How 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

Share this post


Link to post
Share on other sites

No error saying it's not found thats whats confusing me but when I put "MsgBox(0,'','Test') at the top of the include it doens't go. I'm wondering if it's something to do with running from the mother script but I don't know why I start it with @AutoItExe and pass variables too it so it should run like normal right? same directory so i wouldn't think

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

If your include isn't in the AutoIt Directory but instead in the directory with the script put it like this:

#include "Include.au3"
If it is in a sub directory then you can do it like this:

#include ".\Include Folder\Include.au3"
Edited by Rogue5099

Share this post


Link to post
Share on other sites

Ah N00bie mistake, UDF was the same name as one provided by Autoit. Thanks for the help though guys.

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