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 

[script, functions] ScriptMerge 0.92

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Sun Apr 22, 2007 1:21 pm    Post subject: [script, functions] ScriptMerge 0.92 Reply with quote

ScriptMerge


This script provide interface to 2 functions - Join and Unjoin

Join function will join includes of an ahk source file into the script containing no includes.
File will be saved in the directory of original file with the name OriginalName _J_.ahk

Unjoin will return previously joined script to its previous file system hierarchy



Overview
    This script is to be used with complex projects containing one ore more includes. While developing, its often desired to split projects into modules for organization and maintaince reasons. However, sometimes developer wants to provide single include to users of his module but keep his developing organization.

    This script makes possible to join main script file with its includes thus making single .ahk file with no includes that is ready for distribution. Later anybody can recreate original file system structure from the previously joined file. This allows everybody to use original environment if there is a need for further development of the project or bug fixing with original structure in the place.


Remarks
  • Join function doesn't recognize 3 AHK variables allowed to use in #include (A_ScriptDir, A_AppData, A_AppDataCommon). Generaly, there is no need to use those variables anyway.

  • Unjoining script will recreate original file system structure. If there are already files with the names like those that are to be created, the new contest will be appended as FileAppend is used to create files. In final version, function will probably abort in such situations.

  • Files merged with Join function will have _J_ suffix in its name. Its good to leave this at the place so everybody can know from the scripts name if it can be unjoined. If _J_ is not present, the only way to check if script is joined is to check for its GUID, using Search function of your editor. Search for the unquoted string "B1AD529B-BF4E-477F-8B9F-3080CAC55AE3"

  • ScriptMerger is interface to Join and Unjoin functions that you can find in the script. You can use those functions for your own needs. They are documented in the source code.


This is the output for Favmenu 3 script join operation and BBCodeWriter unjoin operation (using main _J_.ahk file previously created with Join function)


History
0.92
- Bug fix
- Sufix changed to _J_ instead !J!

0.91
- Fixed bugs with comments in include lines

0.9
First version
_________________


Last edited by majkinetor on Sat Jan 05, 2008 3:21 am; edited 36 times in total
Back to top
View user's profile Send private message MSN Messenger
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Tue Apr 24, 2007 3:47 pm    Post subject: Reply with quote

This was previously visible under the name Join (includes)
_________________
Back to top
View user's profile Send private message MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10450

PostPosted: Thu Apr 26, 2007 1:33 am    Post subject: Reply with quote

A utility like this has often been asked for. Perhaps I should link to it from the #Include page.

Thanks for creating it.
Back to top
View user's profile Send private message Send e-mail
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Thu Apr 26, 2007 8:39 am    Post subject: Reply with quote

Perhaps.

You should definitely link common dialogs as help now points to outdated scripts.
_________________
Back to top
View user's profile Send private message MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10450

PostPosted: Thu Apr 26, 2007 2:04 pm    Post subject: Reply with quote

I've updated the Gui/DllCall/FileSelectFile/Folder pages to point to your common dialogs topic. I've also linked #Include to this topic here via: "Consequently, [#Include] generally cannot merge two isolated scripts together into one functioning script (to achieve that, see http://www.autohotkey.com/forum/topic18545.html)."

Thanks.
Back to top
View user's profile Send private message Send e-mail
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Thu Apr 26, 2007 2:11 pm    Post subject: Reply with quote

You are welcome.
_________________
Back to top
View user's profile Send private message MSN Messenger
lucgod1



Joined: 27 Oct 2006
Posts: 3
Location: BELGIUM

PostPosted: Wed Aug 29, 2007 11:38 am    Post subject: Join... cool ! Reply with quote

majkinetor wrote:
You are welcome.


Bravo for this "JOIN"
Bye from Belgium.
_________________
lucgod1 (LIEGE - BELGIUM)
Back to top
View user's profile Send private message
Andreone



Joined: 20 Jul 2007
Posts: 257
Location: Paris, France

PostPosted: Wed Aug 29, 2007 12:58 pm    Post subject: Reply with quote

This doesn't work if comments follow the #include directive like
Code:
#include MysubScript.ahk ; this include contains some functions to do some stuffs

The tags are present though, but without the code.

Also:
Quote:
Files merged with Join function will have !J! prefix in its name.

shouldn't it be Files merged with Join function will have !J! suffix in its name?
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Mon Sep 03, 2007 7:21 am    Post subject: Reply with quote

Thx for reporting this.
_________________
Back to top
View user's profile Send private message MSN Messenger
Andreone



Joined: 20 Jul 2007
Posts: 257
Location: Paris, France

PostPosted: Wed Sep 05, 2007 1:35 pm    Post subject: Reply with quote

Quote:
Thx for reporting this.

You're welcome.

I've tried to fix the bug I reported, but I'm not comfortable at all with regexp.
Also, as the fix must be compatible with prior merged scripts, I'm not so sure about where to save the comments (in order to be non destructive)
If I figure something and manage to fix the bug, I'll let you know (but I guess you will be faster than me)
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Fri Sep 07, 2007 11:27 am    Post subject: Reply with quote

Quote:
I've tried to fix the bug I reported, but I'm not comfortable at all with regexp.
Also, as the fix must be compatible with prior merged scripts, I'm not so sure about where to save the comments (in order to be non destructive)
If I figure something and manage to fix the bug, I'll let you know (but I guess you will be faster than me)

Try it now, I think I fixed it.

I don't plan to keep compatibility with older versions, I focus to keep it work correctly. Its bug fix anyway, and it seems ppl didn't use it much so far.

The next thing is that A_ScriptDir should be handled. I don't plan to to support other variables, mainly cuz of security reasons.... I wouldn't like something to write files into places others then local dir.
_________________
Back to top
View user's profile Send private message MSN Messenger
Andreone



Joined: 20 Jul 2007
Posts: 257
Location: Paris, France

PostPosted: Sat Sep 08, 2007 3:08 pm    Post subject: Reply with quote

I confirm, the bug is fix.
Thank you very much.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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