Jump to content

Pragma compile vs AutoIt3Wrapper directives: various problems


Michiel
 Share

Recommended Posts

Which of the two should I use? It seems pragma compile offers access to resource fields that AutoIt3Wrapper only allows access to via Res_Field, such as CompanyName and ProductName. AutoIt3Wrapper offers help with versioning in the form of automatic version increase, pragma doesn't. (afaik)

Should one ever combine the two in one script? Could I e.g. increase the ProductVersion automatically as well with AutoIt3Wrapper?

I'm using the Beta, 3.3.13.19 with Scite 3.4.4 Full as well as TortoiseSVN and WinMerge.

 

Link to comment
Share on other sites

  • Developers

#pragma is a build in resource update feature and AutoIt3Wrapper does the resource update after the creations of the EXE.

You should be able to mix and match as I've build checks in Autoit3Wrapper to ignore any that would conflict an #Pragma statement.

Your choice what you want/like to use.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Did you try the #Pragma ProductVersion option?

The Helpfile is your friend ;)

Jos

 

Yep, but what I'm using is:

#AutoIt3Wrapper_Res_Fileversion=0.64.0.6
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=Y

And if I used

#pragma compile(ProductVersion, 0.62)

...again, I'd have to update this version number again separately, after each commit & compile. If all else fails I'll go ahead and write a post-processing script in Perl.

Link to comment
Share on other sites

  • Developers

I am pretty sure you get some sort of warning telling you that the #autoIt3Wrapper directive is ignored as you can't mix the Version block directives.

> #pragma Compile() found that updates the VERSION Resources.
-    Ignoring all #AutoIt3Wrapper_* #directives that would normally update the VERSION section!

So either use all #Pragma or all Autot3Wrapper directive for the Version block in the program resources.

So in this case I would recommend using the #AutoIt3Wrapper directives only as you want to auto increment the fileversion.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Had a look at AutoIt3Wrapper and can make it so that the  #pragma compile(Fileversion, 0.62) will auto increase when #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=Y is specified, but you still either use all #Pragma or #AutoIt3Wrapper_Res statements to update the VERSION block.

Would that be a good way forward?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yes, that sounds awesome, but just so we're clear about what I'm doing at the moment:

  • I'm only using AutoIt3Wrapper directives right now, I commented out the #pragma directives
  • FileVersion is correctly set in the resource section and also autoincrements after each compilation
  • ProductVersion is correctly set but doesn't autoincrement like FileVersion does, so I currently set ProductVersion to "See File Version" which yields a non-fatal error: apparently (when inspecting with PE Explorer) there are two versions of this string stored, one then says "0" and the other indeed says "See File Version", and the latter is the one you see if you view the compiled binary's properties in Explorer.

There are several ways one could approach this:

  • Allow the use of e.g. %fileversion% inside the source file, so you can set ProductVersion to %fileversion% and the two are synced (This would probably entail some sort of switch to turn this on, otherwise unintended string substitutions in the source may occur, of course, I guess this would be the beginning of something akin to C macros)
  • Create a ProductVersion autoincrement directive alongside the already existing directive for FileVersion
  • Me writing a script which is called in the "Run before" directive, which parses the source and does in-place substitution of certain keywords; I'd probably go with something similar to %fileversion%. This only helps my own project, of course, so no benefits to the AutoIt community
  • Some different way of achieving the same

I also use the version string in the title of the GUI window, so this is another variable which I update manually:

Global $version = '0.63.0.1'

So even after adding an autoincrement directive for ProductVersion, this problem remains.... (Hmmm, unless I read the read the version string from the resource section inside the program, of course! :idea: )

I'm stoked you're even considering a solution, but you're the developer so you know best what would work and doesn't break AutoIt. I am currently using the Beta version because I wanted to use associative arrays (or hash variables, dictionaries, whichever you prefer).

I certainly have no issues with using either #pragma or #AutoIt3Wrapper; I'm currently only using the latter because I thought it would be best not to mix. :-)


Link to comment
Share on other sites

  • Developers

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

 

Yup, that would work ... I'm guessing it would be best to limit that substitution to the #AutoIt3Wrapper block?

Give the current AutoIt3Wrapper Beta version a try which support this and ofcourse only for AUtoIt3Wrapper directives as it would require updating the original source for the #Pragma() to work.

 

Global $version = FileGetVersion(@ScriptFullPath)

That is what I use in scripts and never used the UDF for that. Not sure how they are different and would require to check both sources in detail.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...