AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with #includes

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Petru



Joined: 17 Dec 2007
Posts: 235
Location: Galati, Romania

PostPosted: Fri Nov 20, 2009 10:36 am    Post subject: Problem with #includes Reply with quote

I've got a main script M that is divided into more smaller scripts by #includes.

Consider:

M is dependant on S1 and is dependant on S2.
S1 is also dependant on S2.
=>
I can't #include S1 in S2 and also #include S1 in M because it will give me an error.
S1 doesn't work without S2, so if I want to work on S1 I have to #include S2 in it but M will give an error.

I don't want to get tangled in #includes... I'm now working on a much larger script... what can I do?
Back to top
View user's profile Send private message Yahoo Messenger
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Fri Nov 20, 2009 10:41 am    Post subject: Reply with quote

a) Why not convert include to libraries?
b) I've seen some "include one file to include them all" workarounds on the forum, http://www.autohotkey.com/forum/topic44582.html or perhaps the *i options of Include as described in the doc?
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7295
Location: Australia

PostPosted: Fri Nov 20, 2009 12:49 pm    Post subject: Re: Problem with #includes Reply with quote

Petru wrote:
I can't #include S1 in S2 and also #include S1 in M because it will give me an error.
What sort of error? An error should only occur if the file can't be legitimately "inserted" at the position of the #Include. If the file was already #included, a second #Include will have no effect. Only #IncludeAgain can "insert" the same file twice at different locations.
Quote:
#Include ensures that FileName is included only once, even if multiple inclusions are encountered for it. By contrast, #IncludeAgain allows multiple inclusions of the same file, while being the same as #Include in all other respects.
Source: #Include

Function libraries work similarly to #Include, but are inserted at the very end of the script, in the order they are needed.
Back to top
View user's profile Send private message Visit poster's website
Petru



Joined: 17 Dec 2007
Posts: 235
Location: Galati, Romania

PostPosted: Fri Nov 20, 2009 1:48 pm    Post subject: Re: Problem with #includes Reply with quote

Yep, you were right, Lexikos. I'm just very fuzzy today...
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group