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
Michiel

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  

  • Similar Content

    • Jos
      By Jos
      7/8/2018: Uploaded a new SciTe4AutoIt3.exe v18.708.1148.0 installer.
      It has been over a year since the last update of the full SciTE4AutoIt3 installer whch mainly had to do with the fact that Neil was moving toward v4 of SciTE and I wanted to wait for a stable version.
      Any help with testing this version before general release is appreciated.
      Also any feedback is welcome in caseI missed something or suggestions for improvement before releasing.
      ==> SciTE4AutoIt3 v18.708.1148.0
      Enjoy,
      Jos

      Addition/Changes/Fixes in the current installer:
      -------------------------------------------------------------------------------------------------- 8-7-2018 *** Merged the SciTE v 4.1.0 by Neil Hodgson with our own version of SciTE. (Jos)     This is a major change from the previous version so ensure you update all files including LUA or else you will get errors!     - SciLexer au3: Fixed issues with nested CommentBlocks not always showing the correct color.     - SciLexer au3: Change any line starting with # and no recognised keyword to be shown with the Pre-Processor in stead of default.     - Changed Shortcut for AU3INFO to Ctrl+Shift+F6.     - Moved the session restore logic for (save.session.advanced=1)into SciTE in stead of LoadSession.lua as that was clearing the recent files list of the last session       when opening a file by double cliking it. This is fixed with this change.       Default remains 0 so when a file is double clicked the last session isn't restored unless you add this to SciTEuser.properties:       "save.session.advanced=1"     - updated Tools.lua replacing [s%] with [ /t] to avoid empty lines being stripped by those functions. (Thanks Enyby) *** Updated AutoIt3Wrapper v18.708.1148.0 (Jos)     - 17.224.935.1 Added /autoit3dir to au3stripper commandline, when provided to AutoIt3Wrapper., to ensure the included files are for the correct AutoIt3 directory     - 17.224.935.2 Added directives:          #AutoIt3Wrapper_Res_CompanyName=          ;Company field          #AutoIt3Wrapper_Res_LegalTrademarks=      ;Trademark field     - 17.224.935.5 Fixed Versioning when files contain backets ->  ()     - 17.224.935.6 Added support for :          #AutoIt3Wrapper_Au3stripper_Stop_OnError=        ;(Y/N) Continue/Stop on Warnings.(Default=N)     - 17.224.935.7 added INI support for:           [Other]            Au3Stripper_Stop_OnError=n     - 17.224.935.10 Minor changes in console messages     - 17.224.935.11 Modifications from JPM:         - add #AutpIt3Wrapper_Res_Cursor_Add         - "clean" a little bit AutoIt3Wrapper.au3 *** Updated Au3Stripper v18.708.1148.0 (Jos)     - 17.224.935.1 Fixed crash when an include file contains longer record than 4096 characters.     - 17.224.935.2 Changed /rsln to replace @ScriptLineNumber in the Master script with "XXX/YYY". XXX is the master script linenumber, YYY is the Merged script linenumber.     - 17.224.935.3 Fixed issue detecting #cs #ce when a space was missing after the directive.     - 17.224.935.4 Changed Close/Open logic for Tracelog to (hopefully) avoid the hardcrash.     - 17.224.935.5 improved speed avoiding rereading include files to determine the max rec len.     - 17.224.935.6 improved speed by re-coding the check for long records.     - 17.224.935.7 Made sure the returncode is the highest from all iterations in stead of the last iteration.     - 17.224.935.8 fix for reported bug: https://www.autoitscript.com/trac/autoit/ticket/3623#comment:4     - 17.224.935.9 added support for #autoit3wrapper_autoit3dir     - 17.224.935.10 Fixed support for #autoit3wrapper_autoit3dir when followed by linecomment                     Stop processing when include file isn't found.     - 18.624.1847.1 strip the leading and trailing double quotes from the autoit3dir directive to avoid an error when they are specified.     - 18.624.1847.2 Fixed Hardcrash in the Include logic     - 18.624.1847.3 Fixed Hardcrash in Func stripping logic by enlarging the base table size     - 18.702.1556.1 Fixed regression bug with the Translate option.     - 18.703.1808.2 Fixed regression bug with the Stripping FUNC logic for the first found FUNC. *** Updated SciTEConfig v18.708.1148.0 (Jos)     - 17.224.935.1 No updates *** Updated Tidy v18.708.1148.0 (Jos)     - 17.224.935.1 Added option  to copy comments from #CS to #CE. Default is to copy the comments.                    Added Tidy Parameters:  /Skip_CE_Comment or /scec will skip this copy action                    Added INI option:                      * * *  Add comment to #CE/#CommentEnd and make it the same as the #CS/CommentStart Comments.                      ce_comment=1     - 17.224.935.2 Fix issue with Copy comments on comment start - end     - 17.224.935.4 Fix another issue with Copy comments on comment start - end -------------------------------------------------------------------------------------------------- ==> ScitillaHistory page containing all SciTE-Scintilla updates.
      ==> Visit the SciTE4AutoIt3 Download page for the latest versions
      ==> Check the online documentation for an overview of all extra's you get with this installer.
    • Dreamfire
      By Dreamfire
      Hi,
      Since today, exe's are being flagged as having a trojan by Windows Defender (Fuery.B!cl)
      Version:  3.3.14.3 - SciTE Version 3.7.3



       

    • 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.
×