Sign in to follow this  
Followers 0
FredAI

File version info editor

13 posts in this topic

#1 ·  Posted (edited)

Here's a tool I wrote a couple of months ago witch I'd like to share with you. It can be very useful for programmers, because they can update the version resource without having to compile everything.

File version info editor (FVIE) edits most of the fields in the version resource:

File version, company name, comment, file description, product version, product name, legal copyright, legal trademarks. internal name, original file name, special build, private build.

It also allows to export the version info to an ini file witch you can import later so you won't have to write everything again.

I added an option to backup original file in case something goes wrong.

In the tests I've made, some files compiled with UPX can get damaged so I recommend to always backup the files before editing.

Posted Image

You can find more info and download compiled script here: FVIE

FVIE.zip

Edited by FredAI

Share this post


Link to post
Share on other sites



Missing File Link.

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

very cool FredAI

but when i start the tool from the command line it only recive the file name

and dosn't read the file version info :)

so i allowed my to do a little change

on your code to be like this

NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=fvie_ico.ico
#AutoIt3Wrapper_outfile=File version info editor.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=Don't forget to allways backup the files before editing. Executable files compiled with UPX may not work after resources edition.
#AutoIt3Wrapper_Res_Description=File version info editor
#AutoIt3Wrapper_Res_Fileversion=1.1.1.39
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=Carifred © 2010 - 2011
#AutoIt3Wrapper_Res_Field=CompanyName|Carifred
#AutoIt3Wrapper_Res_Field=ProductVersion|1.1.1.0
#AutoIt3Wrapper_Res_Field=ProductName|FVIE
#AutoIt3Wrapper_Res_Field=LegalTrademarks|Carifred
#AutoIt3Wrapper_Res_Field=InternalName|File version info editor
#AutoIt3Wrapper_Res_Field=OriginalFilename|Fvie.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Constants.au3>
If WinActivate(' File version info editor  ') Then Exit
Global $File = '', $Input[13], $Button[8]

Local $FVIE = GUICreate(' File version info editor  ',450,350)
GUISetState ( @SW_SHOW, $FVIE )
GUISetBkColor ( 0xE0E0FF )

Local $HelpLink = GUICtrlCreateLabel('Click here to get help',100,5,250,15,0x01)
GUICtrlSetColor(-1,0x2222FF)
GUICtrlSetFont (-1, 9, 800, 4, "Arial", 8)
GUICtrlSetCursor(-1,0)

GUICtrlCreateLabel('File to edit:',15,28,65)
GUICtrlSetFont (-1, 9, 800, 1, "Arial", 8)
Local $FileInput = GUICtrlCreateInput('',80,25,265,20)
Local $SearchButton = GUICtrlCreateButton('...Search',350,25,80,21)
GUICtrlSetCursor(-1,0)

GUICtrlCreateLabel('File version:',15,60,200,20,0x01)
$Input[1] = GUICtrlCreateInput('',15,75,200,20)

GUICtrlCreateLabel('Company name:',235,60,200,20,0x01)
$Input[2] = GUICtrlCreateInput('',235,75,200,20)

GUICtrlCreateLabel('Comment:',15,100,200,20,0x01)
$Input[3] = GUICtrlCreateInput('',15,115,200,20)

GUICtrlCreateLabel('File description:',235,100,200,20,0x01)
$Input[4] = GUICtrlCreateInput('',235,115,200,20)

GUICtrlCreateLabel('Product version:',15,140,200,20,0x01)
$Input[5] = GUICtrlCreateInput('',15,155,200,20)

GUICtrlCreateLabel('Product name:',235,140,200,20,0x01)
$Input[6] = GUICtrlCreateInput('',235,155,200,20)

GUICtrlCreateLabel('Legal copyright:',15,180,180,20,0x01)
$Input[7] = GUICtrlCreateInput('',15,195,180,20)
$Button[2] = GUICtrlCreateButton('©',195,195,20,21)
GUICtrlSetFont (-1, 12, 800, 1, "Arial", 8)

GUICtrlCreateLabel('Legal trademarks:',235,180,200,20,0x01)
$Input[8] = GUICtrlCreateInput('',235,195,200,20)

GUICtrlCreateLabel('Internal name:',15,220,200,20,0x01)
$Input[9] = GUICtrlCreateInput('',15,235,200,20)

GUICtrlCreateLabel('Original file name:',235,220,200,20,0x01)
$Input[10] = GUICtrlCreateInput('',235,235,200,20)

GUICtrlCreateLabel('Special build:',15,260,200,20,0x01)
$Input[11] = GUICtrlCreateInput('',15,275,200,20)

GUICtrlCreateLabel('Pivate build:',235,260,200,20,0x01)
$Input[12] = GUICtrlCreateInput('',235,275,200,20)

$Button[3] = GUICtrlCreateCheckbox('Create new version resource',15,305)
$Button[4] = GUICtrlCreateCheckbox('Backup file before editing',15,325)
GUICtrlSetState(-1,1)
$Button[5] = GUICtrlCreateButton('OK, change version resource',265,305,170,35)
GUICtrlSetCursor(-1,0)
$Button[6] = GUICtrlCreateButton('Import from file',170,300,80,20)
GUICtrlSetCursor(-1,0)
$Button[7] = GUICtrlCreateButton('Export to file',170,325,80,20)
GUICtrlSetCursor(-1,0)

;this where changes done
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If $Cmdline[0] = 1 Then     ;<<<<<<<<<<<
    $File = $Cmdline[1] ;<<<<<<<<<<<
    FileAnalise()       ;<<<<<<<<<<<
EndIf                       ;<<<<<<<<<<<
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Local $NewVR = '', $FileVersion = '', $CompanyName = '', $Comments = '', _
$FileDescription = '', $ProductVersion = '', $ProductName = '', _
$LegalCopyright = '', $LegalTrademarks = '', $InternalName = '', _
$OriginalFileName = '', $SpecialBuild = '', $PrivateBuild = ''
GUICtrlSetData($FileInput,$File)

Do
    If $File = '' And GUICtrlGetState($Button[7]) < 128 Then _
    GUICtrlSetState($Button[7], 128)
    If $File <> '' And GUICtrlGetState($Button[7]) >= 128 Then _
    GUICtrlSetState($Button[7], 64)
    If $File = '' And GUICtrlGetState($Button[5]) < 128 Then _
    GUICtrlSetState($Button[5], 128)
    If $File <> '' And GUICtrlGetState($Button[5]) >= 128 Then _
    GUICtrlSetState($Button[5], 64)
    Local $msg = GUIGetMsg()
    Switch $msg
        Case $HelpLink
            IniWrite(@ScriptDir & '\help.url','InternetShortcut','Url','http://www.carifred.com/fvie')
            ShellExecute(@ScriptDir & '\help.url')
            FileDelete(@ScriptDir & '\help.url')
        Case $SearchButton
            Local $FO = FileOpenDialog('Select file to edit',@ScriptDir, _
                'Binary files(*.exe;*.dll;*.sys)',1,'',$FVIE)
            If $FO <> '' Then
                $File = $FO
                GUICtrlSetData($FileInput,$File)
                FileAnalise()
            EndIf
        Case $Button[2]
            GUICtrlSetData($Input[7],'©',1)
            ControlClick(' File version info editor  ','',$Input[7],'primary')
        Case $Button[5]
            If GUICtrlRead($Button[4]) = 1 Then
                Local $Backup = StringMid($File,1,StringInStr($File,'.',2,-1) -1) & '(Backup)' & _
                StringMid($File,StringInStr($File,'.',2,-1))
                If Not FileExists($Backup) Then FileCopy($File,$Backup)
            EndIf
            If GUICtrlRead($Button[3]) = 1 Then $NewVR = ' /va '
            $FileVersion = ' "' & GUICtrlRead($Input[1]) & '"'
            $CompanyName = ' /s CompanyName "' & GUICtrlRead($Input[2]) & '"'
            $Comments = ' /s Comments "' & GUICtrlRead($Input[3]) & '"'
            $FileDescription = ' /s FileDescription "' & GUICtrlRead($Input[4]) & '"'
            $ProductVersion = ' /pv "' & GUICtrlRead($Input[5]) & '"'
            $ProductName = ' /s ProductName "' & GUICtrlRead($Input[6]) & '"'
            $LegalCopyright = ' /s LegalCopyright "' & GUICtrlRead($Input[7]) & '"'
            $LegalTrademarks = ' /s LegalTrademarks "' & GUICtrlRead($Input[8]) & '"'
            $InternalName = ' /s InternalName "' & GUICtrlRead($Input[9]) & '" '
            $OriginalFileName = ' /s OriginalFilename "' & GUICtrlRead($Input[10]) & '"'
            $SpecialBuild = ' /s SpecialBuild "' & GUICtrlRead($Input[11]) & '"'
            $PrivateBuild = ' /s PrivateBuild "' & GUICtrlRead($Input[12]) & '"'
            FileInstall('.\verpatch.exe', @TempDir & '\',1)
            Local $State1 = '', $State2 = ''
            For $i = 1 To 12
                $State1 &= GUICtrlRead($Input[$i])
            Next
            RunWait(@ComSpec & ' /c verpatch.exe "' & $File & '"' & $FileVersion & $NewVR _
            & $CompanyName & $Comments & $FileDescription & $ProductVersion & $ProductName _
            & $LegalCopyright & $LegalTrademarks & $InternalName & $OriginalFileName _
            & $SpecialBuild & $PrivateBuild,@TempDir,@SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            FileDelete(@TempDir & '\verpatch.exe')
            FileAnalise()
            For $i = 1 To 12
                $State2 &= GUICtrlRead($Input[$i])
            Next
            If $State1 = $State2 Then
                MsgBox(0,'Operation succeeded', 'File version info was updated.',0,$FVIE)
            ElseIf GUICtrlRead($Button[3]) = 1 Then
                MsgBox(0,'Operation failed','One or more fields could not be updated.'      & @CRLF & _
                                        'Make sure that file is not in use and try again.'  ,0,$FVIE)
            Else
                MsgBox(0,'Operation failed','One or more fields could not be updated.'              & @CRLF & _
                                            'Check "Create new version resource" box and try again.',0,$FVIE)
            EndIf
        Case $Button[6]
            Local $FileExp = FileOpenDialog('Import from file',@ScriptDir, 'Ini files (*.ini)',1,'',$FVIE)
            If $FileExp <> '' Then
                GUICtrlSetData($Input[1],IniRead($FileExp,'VersionInfo','FileVersion',''))
                GUICtrlSetData($Input[2],IniRead($FileExp,'VersionInfo','CompanyName',''))
                GUICtrlSetData($Input[3],IniRead($FileExp,'VersionInfo','Comments',''))
                GUICtrlSetData($Input[4],IniRead($FileExp,'VersionInfo','FileDescription',''))
                GUICtrlSetData($Input[5],IniRead($FileExp,'VersionInfo','ProductVersion',''))
                GUICtrlSetData($Input[6],IniRead($FileExp,'VersionInfo','ProductName',''))
                GUICtrlSetData($Input[7],IniRead($FileExp,'VersionInfo','LegalCopyright',''))
                GUICtrlSetData($Input[8],IniRead($FileExp,'VersionInfo','LegalTrademarks',''))
                GUICtrlSetData($Input[9],IniRead($FileExp,'VersionInfo','InternalName',''))
                GUICtrlSetData($Input[10],IniRead($FileExp,'VersionInfo','OriginalFilename',''))
                GUICtrlSetData($Input[11],IniRead($FileExp,'VersionInfo','SpecialBuild',''))
                GUICtrlSetData($Input[12],IniRead($FileExp,'VersionInfo','PrivateBuild',''))
            EndIf
        Case $Button[7]
            Local $Name = StringMid($File, StringInStr($File,'\', 2, -1)+1)
            $Name =  StringMid($Name,1, StringInStr($Name,'.', 2, -1)) & 'ini'
            Local $FileExp = FileSaveDialog('Export to file',@ScriptDir, 'Ini files(*.ini)', 0, $Name, $FVIE)
            If $FileExp <> '' Then
                If Stringmid($FileExp,StringLen($FileExp)-3) <> '.ini' Then $FileExp = $FileExp & '.ini'
                If IniWriteSection($FileExp,'VersionInfo', _
                'FileVersion=' & GUICtrlRead($Input[1]) & @LF & _
                'CompanyName=' & GUICtrlRead($Input[2]) & @LF & _
                'Comments=' & GUICtrlRead($Input[3]) & @LF & _
                'FileDescription=' & GUICtrlRead($Input[4]) & @LF & _
                'ProductVersion=' & GUICtrlRead($Input[5]) & @LF & _
                'ProductName=' & GUICtrlRead($Input[6]) & @LF & _
                'LegalCopyright=' & GUICtrlRead($Input[7]) & @LF & _
                'LegalTrademarks=' & GUICtrlRead($Input[8]) & @LF & _
                'InternalName=' & GUICtrlRead($Input[9]) & @LF & _
                'OriginalFilename=' & GUICtrlRead($Input[10]) & @LF & _
                'SpecialBuild=' & GUICtrlRead($Input[11]) & @LF & _
                'PrivateBuild=' & GUICtrlRead($Input[12])) = 1 Then _
                MsgBox(0,'', 'Current settings were successfully exported.',2,$FVIE)
            EndIf
    EndSwitch
Until $msg = -3

Func FileAnalise()
    GUICtrlSetData($Input[1],FileGetVersion($File,'FileVersion'))
    GUICtrlSetData($Input[2],FileGetVersion($File,'CompanyName'))
    GUICtrlSetData($Input[3],FileGetVersion($File,'Comments'))
    GUICtrlSetData($Input[4],FileGetVersion($File,'FileDescription'))
    GUICtrlSetData($Input[5],FileGetVersion($File,'ProductVersion'))
    GUICtrlSetData($Input[6],FileGetVersion($File,'ProductName'))
    GUICtrlSetData($Input[7],FileGetVersion($File,'LegalCopyright'))
    GUICtrlSetData($Input[8],FileGetVersion($File,'LegalTrademarks'))
    GUICtrlSetData($Input[9],FileGetVersion($File,'InternalName'))
    GUICtrlSetData($Input[10],FileGetVersion($File,'OriginalFileName'))
    GUICtrlSetData($Input[11],FileGetVersion($File,'SpecialBuild'))
    GUICtrlSetData($Input[12],FileGetVersion($File,'PrivateBuild'))
EndFunc

now its all ok :)

Edited by M4AutoIt

Share this post


Link to post
Share on other sites

hi FredAI its me again hope im not annoying u

this time i made ur script accept drag n drop action

i gust couldnt stop my self :)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=fvie_ico.ico
#AutoIt3Wrapper_outfile=File version info editor.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=Don't forget to allways backup the files before editing. Executable files compiled with UPX may not work after resources edition.
#AutoIt3Wrapper_Res_Description=File version info editor
#AutoIt3Wrapper_Res_Fileversion=1.1.1.40
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=Carifred © 2010 - 2011
#AutoIt3Wrapper_Res_Field=CompanyName|Carifred
#AutoIt3Wrapper_Res_Field=ProductVersion|1.1.1.0
#AutoIt3Wrapper_Res_Field=ProductName|FVIE
#AutoIt3Wrapper_Res_Field=LegalTrademarks|Carifred
#AutoIt3Wrapper_Res_Field=InternalName|File version info editor
#AutoIt3Wrapper_Res_Field=OriginalFilename|Fvie.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#RequireAdmin
#NoTrayIcon
If WinActivate(' File version info editor  ') Then Exit
Global $File = '', $Input[13], $Button[8]

Local $FVIE = GUICreate(' File version info editor  ', 450, 350, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUISetState ( @SW_SHOW, $FVIE )
GUISetBkColor ( 0xE0E0FF )

Local $DropZone = GUICtrlCreateLabel("", 0, 0, 450, 350)
GUICtrlSetBkColor($DropZone, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetState($DropZone, $GUI_DISABLE)
GUICtrlSetState($DropZone, $GUI_DROPACCEPTED)

Local $HelpLink = GUICtrlCreateLabel('Click here to get help',100,5,250,15,0x01)
GUICtrlSetColor(-1,0x2222FF)
GUICtrlSetFont (-1, 9, 800, 4, "Arial", 8)
GUICtrlSetCursor(-1,0)

GUICtrlCreateLabel('File to edit:',15,28,65)
GUICtrlSetFont (-1, 9, 800, 1, "Arial", 8)
Local $FileInput = GUICtrlCreateInput('',80,25,265,20)
Local $SearchButton = GUICtrlCreateButton('...Search',350,25,80,21)
GUICtrlSetCursor(-1,0)

GUICtrlCreateLabel('File version:',15,60,200,20,0x01)
$Input[1] = GUICtrlCreateInput('',15,75,200,20)

GUICtrlCreateLabel('Company name:',235,60,200,20,0x01)
$Input[2] = GUICtrlCreateInput('',235,75,200,20)

GUICtrlCreateLabel('Comment:',15,100,200,20,0x01)
$Input[3] = GUICtrlCreateInput('',15,115,200,20)

GUICtrlCreateLabel('File description:',235,100,200,20,0x01)
$Input[4] = GUICtrlCreateInput('',235,115,200,20)

GUICtrlCreateLabel('Product version:',15,140,200,20,0x01)
$Input[5] = GUICtrlCreateInput('',15,155,200,20)

GUICtrlCreateLabel('Product name:',235,140,200,20,0x01)
$Input[6] = GUICtrlCreateInput('',235,155,200,20)

GUICtrlCreateLabel('Legal copyright:',15,180,180,20,0x01)
$Input[7] = GUICtrlCreateInput('',15,195,180,20)
$Button[2] = GUICtrlCreateButton('©',195,195,20,21)
GUICtrlSetFont (-1, 12, 800, 1, "Arial", 8)

GUICtrlCreateLabel('Legal trademarks:',235,180,200,20,0x01)
$Input[8] = GUICtrlCreateInput('',235,195,200,20)

GUICtrlCreateLabel('Internal name:',15,220,200,20,0x01)
$Input[9] = GUICtrlCreateInput('',15,235,200,20)

GUICtrlCreateLabel('Original file name:',235,220,200,20,0x01)
$Input[10] = GUICtrlCreateInput('',235,235,200,20)

GUICtrlCreateLabel('Special build:',15,260,200,20,0x01)
$Input[11] = GUICtrlCreateInput('',15,275,200,20)

GUICtrlCreateLabel('Pivate build:',235,260,200,20,0x01)
$Input[12] = GUICtrlCreateInput('',235,275,200,20)

$Button[3] = GUICtrlCreateCheckbox('Create new version resource',15,305)
$Button[4] = GUICtrlCreateCheckbox('Backup file before editing',15,325)
GUICtrlSetState(-1,1)
$Button[5] = GUICtrlCreateButton('OK, change version resource',265,305,170,35)
GUICtrlSetCursor(-1,0)
$Button[6] = GUICtrlCreateButton('Import from file',170,300,80,20)
GUICtrlSetCursor(-1,0)
$Button[7] = GUICtrlCreateButton('Export to file',170,325,80,20)
GUICtrlSetCursor(-1,0)

If $Cmdline[0] = 1 Then
    $File = $Cmdline[1]
    FileAnalise()
EndIf

Local $NewVR = '', $FileVersion = '', $CompanyName = '', $Comments = '', _
$FileDescription = '', $ProductVersion = '', $ProductName = '', _
$LegalCopyright = '', $LegalTrademarks = '', $InternalName = '', _
$OriginalFileName = '', $SpecialBuild = '', $PrivateBuild = ''
GUICtrlSetData($FileInput,$File)

Do
    If $File = '' And GUICtrlGetState($Button[7]) < 128 Then _
    GUICtrlSetState($Button[7], 128)
    If $File <> '' And GUICtrlGetState($Button[7]) >= 128 Then _
    GUICtrlSetState($Button[7], 64)
    If $File = '' And GUICtrlGetState($Button[5]) < 128 Then _
    GUICtrlSetState($Button[5], 128)
    If $File <> '' And GUICtrlGetState($Button[5]) >= 128 Then _
    GUICtrlSetState($Button[5], 64)
    Local $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_DROPPED
            $File = @GUI_DragFile
            GUICtrlSetData($FileInput,$File)
            FileAnalise()
        Case $HelpLink
            IniWrite(@ScriptDir & '\help.url','InternetShortcut','Url','http://www.carifred.com/fvie')
            ShellExecute(@ScriptDir & '\help.url')
            FileDelete(@ScriptDir & '\help.url')
        Case $SearchButton
            Local $FO = FileOpenDialog('Select file to edit',@ScriptDir, _
                'Binary files(*.exe;*.dll;*.sys)',1,'',$FVIE)
            If $FO <> '' Then
                $File = $FO
                GUICtrlSetData($FileInput,$File)
                FileAnalise()
            EndIf
        Case $Button[2]
            GUICtrlSetData($Input[7],'©',1)
            ControlClick(' File version info editor  ','',$Input[7],'primary')
        Case $Button[5]
            If GUICtrlRead($Button[4]) = 1 Then
                Local $Backup = StringMid($File,1,StringInStr($File,'.',2,-1) -1) & '(Backup)' & _
                StringMid($File,StringInStr($File,'.',2,-1))
                If Not FileExists($Backup) Then FileCopy($File,$Backup)
            EndIf
            If GUICtrlRead($Button[3]) = 1 Then $NewVR = ' /va '
            $FileVersion = ' "' & GUICtrlRead($Input[1]) & '"'
            $CompanyName = ' /s CompanyName "' & GUICtrlRead($Input[2]) & '"'
            $Comments = ' /s Comments "' & GUICtrlRead($Input[3]) & '"'
            $FileDescription = ' /s FileDescription "' & GUICtrlRead($Input[4]) & '"'
            $ProductVersion = ' /pv "' & GUICtrlRead($Input[5]) & '"'
            $ProductName = ' /s ProductName "' & GUICtrlRead($Input[6]) & '"'
            $LegalCopyright = ' /s LegalCopyright "' & GUICtrlRead($Input[7]) & '"'
            $LegalTrademarks = ' /s LegalTrademarks "' & GUICtrlRead($Input[8]) & '"'
            $InternalName = ' /s InternalName "' & GUICtrlRead($Input[9]) & '" '
            $OriginalFileName = ' /s OriginalFilename "' & GUICtrlRead($Input[10]) & '"'
            $SpecialBuild = ' /s SpecialBuild "' & GUICtrlRead($Input[11]) & '"'
            $PrivateBuild = ' /s PrivateBuild "' & GUICtrlRead($Input[12]) & '"'
            FileInstall('.\verpatch.exe', @TempDir & '\',1)
            Local $State1 = '', $State2 = ''
            For $i = 1 To 12
                $State1 &= GUICtrlRead($Input[$i])
            Next
            RunWait(@ComSpec & ' /c verpatch.exe "' & $File & '"' & $FileVersion & $NewVR _
            & $CompanyName & $Comments & $FileDescription & $ProductVersion & $ProductName _
            & $LegalCopyright & $LegalTrademarks & $InternalName & $OriginalFileName _
            & $SpecialBuild & $PrivateBuild,@TempDir,@SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            FileDelete(@TempDir & '\verpatch.exe')
            FileAnalise()
            For $i = 1 To 12
                $State2 &= GUICtrlRead($Input[$i])
            Next
            If $State1 = $State2 Then
                MsgBox(0,'Operation succeeded', 'File version info was updated.',0,$FVIE)
            ElseIf GUICtrlRead($Button[3]) = 1 Then
                MsgBox(0,'Operation failed','One or more fields could not be updated.'      & @CRLF & _
                                        'Make sure that file is not in use and try again.'  ,0,$FVIE)
            Else
                MsgBox(0,'Operation failed','One or more fields could not be updated.'              & @CRLF & _
                                            'Check "Create new version resource" box and try again.',0,$FVIE)
            EndIf
        Case $Button[6]
            Local $FileExp = FileOpenDialog('Import from file',@ScriptDir, 'Ini files (*.ini)',1,'',$FVIE)
            If $FileExp <> '' Then
                GUICtrlSetData($Input[1],IniRead($FileExp,'VersionInfo','FileVersion',''))
                GUICtrlSetData($Input[2],IniRead($FileExp,'VersionInfo','CompanyName',''))
                GUICtrlSetData($Input[3],IniRead($FileExp,'VersionInfo','Comments',''))
                GUICtrlSetData($Input[4],IniRead($FileExp,'VersionInfo','FileDescription',''))
                GUICtrlSetData($Input[5],IniRead($FileExp,'VersionInfo','ProductVersion',''))
                GUICtrlSetData($Input[6],IniRead($FileExp,'VersionInfo','ProductName',''))
                GUICtrlSetData($Input[7],IniRead($FileExp,'VersionInfo','LegalCopyright',''))
                GUICtrlSetData($Input[8],IniRead($FileExp,'VersionInfo','LegalTrademarks',''))
                GUICtrlSetData($Input[9],IniRead($FileExp,'VersionInfo','InternalName',''))
                GUICtrlSetData($Input[10],IniRead($FileExp,'VersionInfo','OriginalFilename',''))
                GUICtrlSetData($Input[11],IniRead($FileExp,'VersionInfo','SpecialBuild',''))
                GUICtrlSetData($Input[12],IniRead($FileExp,'VersionInfo','PrivateBuild',''))
            EndIf
        Case $Button[7]
            Local $Name = StringMid($File, StringInStr($File,'\', 2, -1)+1)
            $Name =  StringMid($Name,1, StringInStr($Name,'.', 2, -1)) & 'ini'
            Local $FileExp = FileSaveDialog('Export to file',@ScriptDir, 'Ini files(*.ini)', 0, $Name, $FVIE)
            If $FileExp <> '' Then
                If Stringmid($FileExp,StringLen($FileExp)-3) <> '.ini' Then $FileExp = $FileExp & '.ini'
                If IniWriteSection($FileExp,'VersionInfo', _
                'FileVersion=' & GUICtrlRead($Input[1]) & @LF & _
                'CompanyName=' & GUICtrlRead($Input[2]) & @LF & _
                'Comments=' & GUICtrlRead($Input[3]) & @LF & _
                'FileDescription=' & GUICtrlRead($Input[4]) & @LF & _
                'ProductVersion=' & GUICtrlRead($Input[5]) & @LF & _
                'ProductName=' & GUICtrlRead($Input[6]) & @LF & _
                'LegalCopyright=' & GUICtrlRead($Input[7]) & @LF & _
                'LegalTrademarks=' & GUICtrlRead($Input[8]) & @LF & _
                'InternalName=' & GUICtrlRead($Input[9]) & @LF & _
                'OriginalFilename=' & GUICtrlRead($Input[10]) & @LF & _
                'SpecialBuild=' & GUICtrlRead($Input[11]) & @LF & _
                'PrivateBuild=' & GUICtrlRead($Input[12])) = 1 Then _
                MsgBox(0,'', 'Current settings were successfully exported.',2,$FVIE)
            EndIf
    EndSwitch
Until $msg = -3

Func FileAnalise()
    GUICtrlSetData($Input[1],FileGetVersion($File,'FileVersion'))
    GUICtrlSetData($Input[2],FileGetVersion($File,'CompanyName'))
    GUICtrlSetData($Input[3],FileGetVersion($File,'Comments'))
    GUICtrlSetData($Input[4],FileGetVersion($File,'FileDescription'))
    GUICtrlSetData($Input[5],FileGetVersion($File,'ProductVersion'))
    GUICtrlSetData($Input[6],FileGetVersion($File,'ProductName'))
    GUICtrlSetData($Input[7],FileGetVersion($File,'LegalCopyright'))
    GUICtrlSetData($Input[8],FileGetVersion($File,'LegalTrademarks'))
    GUICtrlSetData($Input[9],FileGetVersion($File,'InternalName'))
    GUICtrlSetData($Input[10],FileGetVersion($File,'OriginalFileName'))
    GUICtrlSetData($Input[11],FileGetVersion($File,'SpecialBuild'))
    GUICtrlSetData($Input[12],FileGetVersion($File,'PrivateBuild'))
EndFunc

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

hi FredAI its me again hope im not annoying u

this time i made ur script accept drag n drop action

i gust couldnt stop my self :)

Hi, M4AutoIt Thank you for your interest on my litle tool and for your exelent ideas.

As for the command line bug, I guess I didn't test it enough. Believe it or not, I hadn't noticed the bug until you mention it.

As for the drag and drop, i had thought about creating it for the file input, but this doesn't work on Windows seven or vista if UAC is activated because windows explorer runs on a lower level than FVIE, witch runs as administrator.

So I decided it was not recomended to create an option that encourages users to disable the UAC.

I've also made some improvements, and fixed some bugs:

Aparently, Verpatch doesn't allow comas in the file version and product version fields, so I used StringReplace() to replace all comas for dots on these fields.

There was a bug on the line FileInstall('verpatch.exe', @TempDir & '\',1) and the script didn't work without compiling witch I fixed.

Also removed the unnecessary $STDERR_CHILD + $STDOUT_CHILD when running verpatch. I had used it for some tests and forgot to delete.

Created a variable to hold the last path used to search for a file to edit so that the next time you search it opens the last path used.

And of course used the fix you mentioned for the command line. As for the drag and drop, do as you will, but I didn't use it.

More info and download compiled script here: FVIE

Regards

FVIE.zip

Edited by FredAI
1 person likes this

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hi, M4AutoIt Thank you for your interest on my litle tool and for your exelent ideas.

As for the command line bug, I guess I didn't test it enough. Believe it or not, I hadn't noticed the bug until you mention it.

As for the drag and drop, i had thought about creating it for the file input, but this doesn't work on Windows seven or vista if UAC is activated because windows explorer runs on a lower level than FVIE, witch runs as administrator.

So I decided it was not recomended to create an option that encourages users to disable the UAC.

I've also made some improvements, and fixed some bugs

.

.

As for the drag and drop, do as you will, but I didn't use it.

Regards

Very thanks 4 u FredAI

and for that UAC u realy opened my eyes :)

hope u keep going 4word

thanks agian

Regards

Edited by M4AutoIt

Share this post


Link to post
Share on other sites

Is there an option to change the language id? This might help replacing the current version info rather then adding a new named 0. :)

Share this post


Link to post
Share on other sites

Verpatch doesn't support changing the language info.

Here's an extract of the readme file:

*2: The "Language" value is the name of the language code specified in the header of the string block of VS_VERSION_INFO resource.

(or taken from VarFileInfo block?)

It is displayed by Windows Explorer, but is not contained in the version data.

ReadMe.txt

Share this post


Link to post
Share on other sites

Verpatch doesn't support changing the language info.

Here's an extract of the readme file:

ReadMe.txt

The only way for AutoIt exe’s made by AutoIt3Wrapper is to change the language ID to 0 in the AutoIt3Wrapper so later when it comes to updating the version info it won't add a new one.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Thanks for the source i was looking for this for a while now :D

and where did you get verpatch ?

Edited by 1234hotmaster

Share this post


Link to post
Share on other sites

Just downloaded this tool to modify my complied autoit scripts info.

At first all I got was the error that one or more files could not be updated.

After a little trial & error, I found that I had to make two specific entries;

1. Re-enter the File version as 4 numbers separated by periods.

2. Enter the Product Version as 4 numbers separated by periods.

As long as I made these two changes exactly.. then I was able to update my Auotoit exes just fine.

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