AutoHotkey Community

It is currently May 24th, 2012, 3:32 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Script Merging Standard
PostPosted: January 31st, 2007, 12:17 am 
Offline

Joined: February 13th, 2006, 10:40 pm
Posts: 389
Location: Utah
A couple weeks ago, i noticed that the various scripts i had downloaded from the forum or made myself were each taking 3-5 megs of memory to run. Not a huge deal, but if you have several running you could be using 20-40 megs of memory. So I created a Master.ahk that contained all of the others (except for some more advanced ones like launcher and sysinfo)

One thing that i quickly noticed was that some scripts could not be squished so easily. Many guis are labeled 1,2,3,etc as well as the common 99.

Variables pose another possible overlap. Simple names like val,name,var,temp, etc are too common, and might cause the scripts to interfere with each other. Also, if one script has a memory leak it could pose problems.

Other problems include tray icons, setformat, coordmode etc.

However, these problems can be solved (except guis...) by a standard of programming "etiquette" if you will. i think it would be useful to provide scripts to people in a way that they can be consolidated cleanly and easily.

I have quickly created a BETA script Merger, and depending on the reaction i get from my fellow users i will continue.

Making a script conform to the standard is easy, and will not affect running the script alone. We simply place XML tags within comments in the script

Code:
;<script template="0.1">
;<name>Script Name</name>
;<author>Author</author>
;<version>1.0</version>
;<description>This is the template for the Script Merging Standard 1.0</description>
;<autoexecute>
...
autoexecute code
...
return
;</autoexecute>
;<functions>
...
gosubs, hotkeys, and functions go here
...
;</functions>
;</scripts>


Here is the Script Merger BETA 0.1and two example scripts (Lock Check and my Volume Program)

Download Merger01.zip

I was thinking maybe we could make a standard, unless a var is in a function it must be prepended with something unique like Launch_varname. Things like menu,tray,icon and setformat should be changed just before they are used, and changed back to their default after they are used. That kind of thing. What do you all think?

_________________
Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2007, 12:22 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Nice. I know there will be demand for this.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2007, 9:12 am 
Offline

Joined: January 7th, 2006, 1:38 pm
Posts: 47
Location: Oslo, Norway
Good work. This would be very useful. I'm an AHK novice and merging scripts isn't too easy for me, but I suspect this would be very helpful!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2007, 9:21 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
I already explained merging problems. Its far from easy like you specified......

And you didn't take into account most problematic thing - OnMessage.
And what about Gui numbers ?
Oh.. yes, I forgot this nasty one, for witch there is no solution: if one script has some continious thingie nothing else can work while it does.... as it will block execution of other scripts. It can simply show the message box and all included scripts are doomed. :)

Also, 3-5 mega of RAM usage is not correct anylisis. Its more like 1-2 MB cuz of planty of shared memory that is repeatedly counted for eatch process.

I think this is the bigest problem of AHK and making this solo thing to work will create entirely different working environment. As multithreading is in question it requires complete redesign of internals of AHK, and you guess that Chris has no time for that. Other developers maybe, one day... but I didn't see this in any scripting language...

_________________
Image


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: No registered users and 17 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