Jump to content


Photo

[script, functions] ScriptMerge 0.92


  • Please log in to reply
15 replies to this topic

#1 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 22 April 2007 - 12:21 PM

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



#2 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 24 April 2007 - 02:47 PM

This was previously visible under the name Join (includes)

#3 Chris

Chris
  • Administrators
  • 10727 posts

Posted 26 April 2007 - 12:33 AM

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

Thanks for creating it.

#4 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 26 April 2007 - 07:39 AM

Perhaps.

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

#5 Chris

Chris
  • Administrators
  • 10727 posts

Posted 26 April 2007 - 01:04 PM

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.

#6 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 26 April 2007 - 01:11 PM

You are welcome.

#7 lucgod1

lucgod1
  • Members
  • 5 posts

Posted 29 August 2007 - 10:38 AM

You are welcome.


Bravo for this "JOIN"
Bye from Belgium.

#8 Andreone

Andreone
  • Members
  • 257 posts

Posted 29 August 2007 - 11:58 AM

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?

#9 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 03 September 2007 - 06:21 AM

Thx for reporting this.

#10 Andreone

Andreone
  • Members
  • 257 posts

Posted 05 September 2007 - 12:35 PM

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)

#11 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 07 September 2007 - 10:27 AM

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.

#12 Andreone

Andreone
  • Members
  • 257 posts

Posted 08 September 2007 - 02:08 PM

I confirm, the bug is fix.
Thank you very much.

#13 trismarck

trismarck
  • Members
  • 229 posts

Posted 08 February 2012 - 08:13 PM

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.

#14 yourbuddypal

yourbuddypal
  • Members
  • 32 posts

Posted 03 August 2012 - 03:37 PM

This sounds interesting, but the links are all dead unfortunately...

#15 SKAN

SKAN
  • Administrators
  • 9062 posts

Posted 04 August 2012 - 06:39 AM

[ SKAN's Dropbox ]