mahesh Posted August 18, 2006 Share Posted August 18, 2006 Hi all, I have 2 function in script1.au3 and I want to call function from this file in another file script2.au3. As both the scripts are located in different directories #include "script1.au3" doesnt work Please help immediately. Link to comment Share on other sites More sharing options...
Valuater Posted August 18, 2006 Share Posted August 18, 2006 Show script = we help 8) Link to comment Share on other sites More sharing options...
Xenobiologist Posted August 18, 2006 Share Posted August 18, 2006 (edited) HI,First script saved as funca.au3Func a() MsgBox(0,"info", "works") EndFunc oÝ÷ Ù'¢wlr¸©µ«¢+Ø(¥¹±Õ±ÐíÕ¹¹ÔÌÐì) ¤(Both saved in same folder, otherwise you need the complete path like: c:\ ....So long,Mega@Valuater: Maybe you could explain how to use two funcs in two scripts with same name :"> Edited August 18, 2006 by th.meger 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 More sharing options...
Valuater Posted August 18, 2006 Share Posted August 18, 2006 (edited) noteIn an AutoIt script, other scripts can be included using the #include" command.If "..." is used, the filename is taken to be relative to the current script.#include<funca.au3> must be placed in the running autoit versions \include folder8) Edited August 18, 2006 by Valuater Link to comment Share on other sites More sharing options...
Paulie Posted August 18, 2006 Share Posted August 18, 2006 Please help immediately.Yes master, I'll get right on it A little rude don't you think, and not even a 'Thank You'. There are 3 things you need to learn before requesting 'immediate' helpALWAYS show your code and be specific with your questions.ALWAYS read the help file and/or search the forums before posting.NEVER act like you deserve to have a code wrote for you.Following these guidelines when posting will get you both quicker and more accurate results Plus more respect on the forum ---------- Anyway, To include a script, simply copy it in the include directory of the autoit3 folder in Program Files Then call it like this: #Include <*YourScript.au3*> Otherwise, as said before, call an include with the full path to the target file Link to comment Share on other sites More sharing options...
mahesh Posted August 18, 2006 Author Share Posted August 18, 2006 ;This file is present in c:\scripts folder script1.au3 Func Myfunction() msgbox(0,"r","hi") Endfunc ;I have another script in d:\scripts folder script2.au3 #include"script1.au3" Myfunction() When I executes script2.au3, it gives error "function not found" and also I dont want give full path of script1.au3 in #include, I hope this clears the problem Link to comment Share on other sites More sharing options...
Valuater Posted August 18, 2006 Share Posted August 18, 2006 ;This file is present in c:\scripts folderscript1.au3Func Myfunction() msgbox(0,"r","hi")Endfunc ;I have another script in d:\scripts folderscript2.au3#include"script1.au3"Myfunction()When I executes script2.au3, it gives error "function not found" and also I dont want give full path of script1.au3 in #include,I hope this clears the problemyour question has been answered already... see above posts8) Link to comment Share on other sites More sharing options...
Paulie Posted August 18, 2006 Share Posted August 18, 2006 ...I dont want give full path of script1.au3 in #includeWell then, You have 2 choicesTake a copy of the script to be included and put it in your include folder(C:\Program Files\Autoit3\Include)copy the contents of the script to be included into you other script Link to comment Share on other sites More sharing options...
Valuater Posted August 18, 2006 Share Posted August 18, 2006 Well then, You have 2 choicesTake a copy of the script to be included and put it in your include folder(C:\Program Files\Autoit3\Include)copy the contents of the script to be included into you other scriptPaulie... there is the one additional choiceinclude"filename.au3"the OP should look at the help file for "inlude"8) Link to comment Share on other sites More sharing options...
Paulie Posted August 18, 2006 Share Posted August 18, 2006 the OP should look at the help file for "inlude"Agreed,there is a link to an online one in my previous post (#5) Link to comment Share on other sites More sharing options...
Xenobiologist Posted August 18, 2006 Share Posted August 18, 2006 note #include<funca.au3> must be placed in the running autoit versions \include folder 8) HI, I would say no, because it works for me, this way #include<funca.au3> (when saved in same folder). and this way anytime. #include<c:\Downloads\AutoIt-Skripte\Entwicklung\ForumTests\funca.au3> a() Still left: Maybe you could explain how to use two funcs in two scripts with same name :"> So long, Mega 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 More sharing options...
MHz Posted August 18, 2006 Share Posted August 18, 2006 (edited) .....otherwise you need the complete path like: c:\ ....Edit:If your include folder in "D:\scripts" is a permanent main usage include folder for any script, then SciteConfig in Scite4AutoIt3 has an option to add an additional include folder into registry so AutoIt3 may look there for includes also as well as the standard includes. Edited August 18, 2006 by MHz 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