Sign in to follow this  
Followers 0
Michiel

Pragma compile vs AutoIt3Wrapper directives: various problems

15 posts in this topic

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.

 

Share this post


Link to post
Share on other sites



#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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks Jos,

Is there some way to update ProductVersion automatically, just like FileVersion? I.e. to synchronize the two?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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. :-)


Share this post


Link to post
Share on other sites

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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


Share this post


Link to post
Share on other sites

Just to complete the picture, I've got this in there too:

#AutoIt3Wrapper_Run_After=move "%out%" "%scriptdir%\%scriptfile%v%fileversion%.exe"

Share this post


Link to post
Share on other sites

Any idea why this doesn't work, by the way?

Global $version = _Resource_GetAsString('FileVersion')

Gives me an empty string..

Using ResourcesEx UDF.

Share this post


Link to post
Share on other sites

This works, although a bit unelegant perhaps, given that I've got ResourceEx UDF loaded.

 

Global $version = FileGetVersion(@ScriptFullPath)

 

OTOH, what would FileGetVersion do differently than ResourceEx under the hood? Read from memory instead of disk? It seems to be calling _WinAPI_LoadLibraryEx, so practically equivalent, I presume.

Share this post


Link to post
Share on other sites

 

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

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Great stuff, thanks.

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • WoodGrain
      By WoodGrain
      Hi All,
      I'm using UseTraySetIcon("shell32.dll", xx) to set my tray icon to a specific icon while running, is there a way I can specify this icon when I compile my script into an exe so my exe icon is the same?
      Thanks!
    • 9252Survive
      By 9252Survive
      Hello Guys, 
      Is there a way to have Auto it Exe messages/line number when you hover over the tray icon just at it shows when you run Au3.?
      For an example, if I the script has paused due to WinWait or Sleep I could hover over the icon and it shows the line where it's at. Is there a way to achieve the same with the compiled exe? 
      Many thanks for the help! 
       
    • mati
      By mati
      Hi,
      I wonder if
      AutoIt3Wrapper_run_debug_mode = Y can include run information about functions which are called within the main code. So far I noticed in the console that the function itself is called but no specific run information from  inside the function is provided. Is there a chance to show the entire debug log including functions in the console?
      I furthermore noticed a stop of information when a loop is entered. What could be the reason for that?
       
      Thanks for help.
    • Daka
      By Daka
      Hello there,
       
      When I compile script and use it out of the map where 
      the source code is. So just moving main.exe to
      other map, then source code is.
      It breaks with error:
      Line10010
      Error: Subscript used on non-accessible variable

      So I wonder what kind of file do I need to 
      include with .exe file? Or should I do something else?

      Because people that are using needs only .exe file
      just start it and use it, with out source code.