Jump to content
Sign in to follow this  
Michiel

Pragma compile vs AutoIt3Wrapper directives: various problems

Recommended Posts

Michiel

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
Jos

#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                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Michiel

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
Michiel

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
Jos

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                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Jos

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                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Michiel

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
Jos

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

Share this post


Link to post
Share on other sites
Michiel

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
Michiel

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
Michiel

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
Michiel

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
Jos

 

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

  • Like 1

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

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  

  • Similar Content

    • drapdv
      By drapdv
      So, I have this odd issue happening with UIAWrappers.  When I run simplespy.au3 through SciTE, it finds the object I'm trying to work with, no problem. But, when I compile simplespy.exe, it can't find it.  Another script that utilizes UIAWrappers is experiencing the same phenomenon. EDIT: Compiling as 32-bit or 64-bit does not affect this behavior.
      The trouble starts at the very first object I try to get via _UIA_getObjectByFindAll, so I included the $properties2Match array and the object properties that were returned by _UIA_getPropertyValue for that first object both when running from SciTE and when compiled.
      It always finds the matches for the title and control type properties.  But when compiled, it fails to find the Automation ID property.  Any ideas as to why this would be happening?  Hoping junkew will see this and have an idea.
       
      These are the $properties2Match
      30005|Screen/PVN - ###.###.##.## - CDK Drive|0|False
      30003|50032|0|False
      30011|Portal|0|False
       
      Object properties when running from SciTE:
      <propertymatching>       
              j:1 propID:[30005] expValue:[Screen/PVN - ###.###.##.## - CDK Drive]actualValue:[Screen/PVN - ###.###.##.## - CDK Drive]1
              j:2 propID:[30003] expValue:[50032]actualValue:[50032]1
              j:3 propID:[30011] expValue:[Portal]actualValue:[Portal]1  
      </propertymatching>
       
      Object properties when script is compiled:
      <propertymatching>
              j:1 propID:[30005] expValue:[Screen/PVN - ###.###.##.## - CDK Drive]actualValue:[Screen/PVN - ###.###.##.## - CDK Drive]1
              j:2 propID:[30003] expValue:[50032]actualValue:[50032]1
              j:3 propID:[30011] expValue:[Portal]actualValue:[]0  
      </propertymatching>
       
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      I was trying to compile my executable, adding #pragma directives instead of #AutoIt3Wrapper* directives, and, I don't know why the #pragma compile doesn't add the Author field to the executable.

      These are the directives:
      #pragma compile(Author, 'Surname Name') ; or #pragma compile(Author, Surname Name)
      and this is the output, in both cases:
       
      - #pragma directive Author found but don't understand it so will ignore: #pragma compile(Author, 'Surname Name') - #pragma directive Author found but don't understand it so will ignore: #pragma compile(Author, Surname Name) What am I missing?
      Thanks

      Francesco
    • Barrtrek
      By Barrtrek
      I get the "Unable to add resources" error related to AppData\Local\AutoIt v3\Aut2Exe when compiling with a large FileInstall of a 1.5GB file.  Is there a size limit I need to be aware of?  I've also disabled or removed Trend from three different machines and had the same results.  I've had issues like this in the past but have compiled after the Aut2Exe folder was excluded in AV.  That doesn't seem to be the problem this time around.  If I comment out the FileInstall the script compiles successfully.
    • nacerbaaziz
      By nacerbaaziz
      Hello all
      I have a question please
      I have a link to an .exe file
      for example this link
      https://www.nvaccess.org/files/nvda/releases/2017.1/NVDA_2017.1.exe
      I want to check if the link is exists orno
      surely  Without downloading the file
      is there any  function or a way to  do this?
      Thanks in advance
    • Earthshine
      By Earthshine
      This baby can do almost any language! I found Gleany on this site and set it up on a fresh win10 install. all i would need to do to make it build an exe of the search files app we discovered is the .NET Target Framework download to build 100 % but the exe works and generates! You also need to add the path the the version of csc.exe that you want to run. MSBuild is part of .NET and can read your .csproj file.
      YOU can develop .NET OR C/C++ on this baby!
      Super lightweight (fit for crappy laptops), and you can use any dev compilers you wish, Ming, MS, etc, whatever.
      To use the build, you need to open the csproj file, else, to check your syntax it can compile individual files as well. The warning are because I do not have the .NET 4.6 Targeting Pack installed... LOL, and I could get rid of the Core warning, yes, I did not want to build a .NET Core.dll I wanted a live x64 exe! Told you MSBUILD could handle .CSPROJ, .VBPROJ, and all others Microsoft. Don't let Visual Code or Visual Studio slow you down, although, this works with Visual Code as well but there is only debugging in CORE.DLL projects

      ListFiles Example.zip
       

×