Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[script, functions] ScriptMerge 0.92


  • Please log in to reply
17 replies to this topic
majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

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)


Join.PNGBBCode.PNG

Download [ SKAN's Dropbox ]

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

0.91
- Fixed bugs with comments in include lines

0.9
First version


Posted Image

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
This was previously visible under the name Join (includes)
Posted Image

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
A utility like this has often been asked for. Perhaps I should link to it from the #Include page.

Thanks for creating it.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
Perhaps.

You should definitely link common dialogs as help now points to outdated scripts.
Posted Image

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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 <!-- m -->http://www.autohotke...topic18545.html<!-- m -->)."

Thanks.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
You are welcome.
Posted Image

lucgod1
  • Members
  • 5 posts
  • Last active: Jul 23 2010 07:16 PM
  • Joined: 27 Oct 2006

You are welcome.


Bravo for this "JOIN"
Bye from Belgium.
lucgod1 (LIEGE - BELGIUM)

Andreone
  • Members
  • 257 posts
  • Last active: Mar 19 2008 05:30 PM
  • Joined: 20 Jul 2007
This doesn't work if comments follow the #include directive like
#include MysubScript.ahk ; this include contains some functions to do some stuffs
The tags are present though, but without the code.

Also:

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?

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
Thx for reporting this.
Posted Image

Andreone
  • Members
  • 257 posts
  • Last active: Mar 19 2008 05:30 PM
  • Joined: 20 Jul 2007

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)

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

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.
Posted Image

Andreone
  • Members
  • 257 posts
  • Last active: Mar 19 2008 05:30 PM
  • Joined: 20 Jul 2007
I confirm, the bug is fix.
Thank you very much.

trismarck
  • Members
  • 390 posts
  • Last active: Nov 25 2015 12:35 PM
  • Joined: 02 Dec 2010
That will probably be a necro post but anyway, if there is an #include *i library.ahk and the library file does not exist, I think the script should skip displaying the 'REMOVED!' message.

yourbuddypal
  • Members
  • 32 posts
  • Last active: May 17 2013 06:50 AM
  • Joined: 29 Jun 2009
This sounds interesting, but the links are all dead unfortunately...

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
[ SKAN's Dropbox ]