AutoHotkey Community

It is currently May 27th, 2012, 1:27 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Problem with #includes
PostPosted: November 20th, 2009, 11:36 am 
Offline

Joined: December 17th, 2007, 6:39 pm
Posts: 235
Location: Galati, Romania
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 11:41 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
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 FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 20th, 2009, 1:49 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 20th, 2009, 2:48 pm 
Offline

Joined: December 17th, 2007, 6:39 pm
Posts: 235
Location: Galati, Romania
Yep, you were right, Lexikos. I'm just very fuzzy today...


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], iDrug, Ohnitiel, Yahoo [Bot] and 26 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group