Jump to content
Sign in to follow this  
Michiel

Pragma compile vs AutoIt3Wrapper directives: various problems

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.

 

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

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

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

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

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

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

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

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

    • By SgtHugoStiglitz
      HI people,
                        I got a questions, I maintain code in autoIT and every time I compile a new version or modification, Scite generate 2 folders. One folder is finish by released and the other is tentative. I try to make some google search, but never find answer would satisfied myself. The dev who was maintain it before were using AutoIt3Wrapper_GUI, and I don't know if it's related. I look both folder, but they seem pretty identical, but I would like to know what it's the difference between those to folder. Anyone have a clue?
    • By Rhidlor
      I don't have any experience compiling AutoIt scripts or know of any best practices regarding said scripts so I was wondering, what are some of the options for passing data to complied scripts? Here's an example of what I mean by "option": Writing data to a text file, then running a script which reads the data from that text file.
      Thanks!
      I apologize if this topic is a little lackluster
    • By Pike
      Hey Everyone, I haven't been here in a while and recently picked up my old project. Still an FNG!
      To the point: I want to be able to push the button and either play an mp3, open a file, or open an exe program (all with the same button). The problem is that I don't know how to code for that at "case 1"
              Case 1                                                                                                                                             
                  Local $sRead = IniRead("config.ini", "Config", "One", "Default")                                
                  SoundPlay($sRead, @HotKeyPressed)                                                                     <-------------------------------
                  Run($sRead, @HotKeyPressed)                                                                                 <------------------------------- This 'Run' doesn't work even by itself!
      See code below for layout. If you need more information I will attach more code or answer any questions. Any help is greatly appreciated.
       
      Much Respect,
      Pike
       
      Func _HandleButton() $iClickCount += 1 $iTimer = TimerInit() AdlibRegister("CheckButtonPress", $CheckTime) EndFunc Func CheckButtonPress() If TimerDiff($iTimer) < $CheckTime Or $iTimer = 0 Then Return Switch $iClickCount Case 1 Local $sRead = IniRead("config.ini", "Config", "One", "Default") SoundPlay($sRead, @HotKeyPressed) Run($sRead, @HotKeyPressed) Case 2 MsgBox(0, "INFORMATION:", "Choose the file you want designated to this button") Local $sFileOpenDialog = FileOpenDialog(0, @ScriptDir & "\", "All (*.*)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") EndIf Local $sFileName = InputBox("INFORMATION:", "Please Name Your File?" & @CRLF _ & @CRLF _ & "6 Characters or Less", "") IniWrite(@ScriptDir & "\config.ini", "Config", "One", $sFileOpenDialog) IniWrite(@ScriptDir & "\config.ini", "Config", "NameOne", $sFileName) EndSwitch $iClickCount = 0 AdlibUnRegister() EndFunc  

    • By Skeletor
      Hey All,
      Yes, this is an odd request. 
      But is there a way to bulk up the size of the compiled program? 
      I know many want to reduce it's size, but I want to increase it.
      What methods do you suggest?
×
×
  • Create New...