AutoHotkey Community

It is currently May 27th, 2012, 6:52 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: #version directive
PostPosted: November 27th, 2006, 10:37 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
For internal check of given version of autohotkey, how about of an #version directive instead of the #v2 directive?
Code:
#version 1.0.45.04
If the version used to create is newer than the one which currently interprets the script, it could automatically start a user defined subroutine or if not any defined, the default one of autohotkey could be executed automatically. The check would be done before interpreting of script, as first.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2006, 4:40 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
It's an interesting idea. Although the benefits don't seem huge, the implementation might be simple (except for the part about running a user-defined subroutine -- instead, it would probably just show an error dialog).

I'll put it on the to-do list for further consideration. Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2006, 11:48 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
It should be flexible:
#version 1
#version 1.0.44
#version 1.0.45.03
#version 2

and so on.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2006, 12:13 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
I have a function that does it.
Code:
;Function CheckAHKVersion: checks if minimum required AHK version is used
;returns 1 if current version is lower then required
CheckAHKVersion(Required_AHK_version){
    StringSplit, A, A_AHKVERSION, .
    Loop, Parse, Required_AHK_version, .
        If (A%A_Index% < A_LoopField )
            Return 1
  }
Can be easily extended.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2006, 11:51 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
Yes toralf, I use on my own scripts also a version check of autohotkey. But the advantage on having the #version directive would be that AutoHotkey loads all included scripts and takes all #version directives in to the oldest one for checking.
Also, libraries without having an autoexecution area could have also easily an version check, before anything other on the script would be executed.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 29th, 2006, 8:39 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Good point.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 29th, 2006, 5:52 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Tuncay wrote:
But the advantage on having the #version directive would be that AutoHotkey loads all included scripts and takes all #version directives in to the oldest one for checking.
Although that would be more complicated to implement, I've made a note of it.

Part of the problem is that old versions of AutoHotkey can display syntax errors when they encounter new syntax, but they do so before all included files have been looked at. Since changing this would probably require a major redesign of script loading and parsing, I think #version should simply display a version error if #version is encountered before anything else that would cause a syntax error.

Thanks for the ideas.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: bump
PostPosted: December 1st, 2010, 12:06 pm 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
*bump*

Quote:
After custom builds and new Ahk_L, such a #version directive is more important.

..from a recent conversation -> AHK_L Versions and compatibility..


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 17th, 2011, 5:28 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
*bump* too
Hope this will be added in the near future. It would add another layer of version documentation, which is not unimportant. And the sooner it gets implemented, the better is it. But I nearly think, its too late.

Edit:
Chris wrote:
Part of the problem is that old versions of AutoHotkey can display syntax errors when they encounter new syntax, but they do so before all included files have been looked at.

I know, Chris is not maintaining anymore. But this is a general answer, not to him only.
Any AutoHotkey version not supporting the directive should not run the script. If you have an old version installed and have a script written for a newer version, its perfectly ok if the old AHK cannot run the script, because not knowing the version directive. So it is a big plus.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 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