GreenCan

CheckUpdate - AutoUpdate a running script (or .exe) over the Web

13 posts in this topic

#1 ·  Posted (edited)

Edit 2: Version 1.0.0.3 including View History of Changes function

post-42917-0-76183500-1403819115_thumb.j
Edit 1: Amended source code on guinness advise (replacement of obsolete _Iif() )
 
Example of Auto Updating of a running script using Internet Web download.
Works as well for compiled as for uncompiled scripts.
Download with file size and checksum verification
 UpdateTest_1.0.1.3.au3 this is version 1.0.1.2 for the update example
Helper to setup file data (version, date, filesize and CRC) in AppsUpdates.txt
AppsUpdates_Calculator.au3

Credits:

MsgBoxEx() used in in the example written by Ward

_CRC32() also by Ward (just a coincidence)

version 1.0.0.2:

previous version without history of changes


UpdateTest.au3 ver 1.0.0.2 (previous downloads: 10)
[UpdateTest.au3]
version=1.0.1.1
date=2014/06/17 17:29
Filesize=17109
CRC=98756666
download=http://users.telenet.be/GreenCan/AutoIt/Updates/UpdateTest_1.0.1.1.au3

[UpdateTest.exe]
version=1.0.1.1
date=2014/06/17 17:56
Filesize=472576
CRC=0D9477D5
download=http://users.telenet.be/GreenCan/AutoIt/Updates/UpdateTest_1.0.1.1.exe

The web directory has 3 files:


Before you test the script, compile it first with AutoIt3Wrapper, to get the version number in the executable.
You can test it then with both compiled and uncompiled versions.
 
The script example will check the application update version in file AppsUpdates.txt on the update website. If required, it will propose the upgrade. You can then disregard it or accept the update.

The new 'View Changes' button will download and display the change information text.
 
If updating, the initial script will be renamed with it's version number (as safety backup), and the new updated will be renamed to the initial script file name, in order not to break shortcuts.
There is no code to postpone the update proposal by a number of days, this has to be programmed separately.
 
Web data file AppsUpdates.txt content (INI file)

now includes a new line containing the url to history file:

changes=...

[UpdateTest.au3]
version=1.0.1.3
date=2014/06/26 23:00
Filesize=22234
CRC=77446F0C
download=http://users.telenet.be/GreenCan/AutoIt/Updates/UpdateTest_1.0.1.3.au3
changes=http://users.telenet.be/GreenCan/AutoIt/Updates/UpdateTest_HistoryOfChanges.txt

[UpdateTest.exe]
version=1.0.1.3
date=2014/06/26 23:02
Filesize=490496
CRC=28974906
download=http://users.telenet.be/GreenCan/AutoIt/Updates/UpdateTest_1.0.1.3.exe
changes=http://users.telenet.be/GreenCan/AutoIt/Updates/UpdateTest_HistoryOfChanges.txt

The web directory has 3 files:

  • AppsUpdates.txt (the updater data file)
  • UpdateTest_1.0.1.1.exe
  • UpdateTest_1.0.1.1.au3

 

 

Edited by GreenCan
2 people like this

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites



MsgBox in a function? _Lif? ConsoleLog? bat file? ini virtual? are you serious??  good that you did not think to add EXIT  :geek:

Share this post


Link to post
Share on other sites

Hi Wayfarer,

OK, What is the problem with this?

  • MsgBox in the function: how do you advise the user if there is a newer version available?  MsgBox in case of errors can be deleted but then you have to cover the message at the function exit.
  • _Iff() is a standard function of AutoIt, I like it very much because it permits to reduce the number of lines in a code.
  • Consolewrite is there to give some explanation in the function, they are meant to be deleted when you use it in real life.
  • bat file: well, if there is another simple way to do it, please let me know, I am really interested... (with embedded AutoIt script, it won't work, with a compiled side program, it will, but then it is not embedded anymore)
  • ini virtual, OK, I could have saved the file, use regular IniRead() and delete the file afterwards. but maybe this is a bit more complex...
  • Exit?  Yes, I use it in line 193 :)
  • You forgot the CRC, the InetGet() with progress bar and also the way that I get the version number in the non-compiled example ;)

I appreciate however that you like the example.

No, seriously, it looks complex, but by the end, the version update checker is performed through a single call to CheckUpdate() and it works.

GreenCan

I


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

_Iif() was removed from the language ages ago.

As with regards to the MsgBox() in a function, is this meant to be a UDF? If so then you should use SetError() and document what each @error message corresponds to, so the developer can decide on how to output that to the end user. You will notice that we don't use MsgBox() in the UDFs and for good reason too.

Edited by guinness

_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

_Iif() was removed from the language ages ago.

Hi guinness,

It is not yet removed from Misc.au3 (I guess to allow AutoIt members to have time to remove the code before the next release),  I admit it is now undocumented in the latest AutoIt release (not available anymore in the helpfile)

But in the previous v3.3.8.1 release (still used by a lot of people), it was still available in Helpfile.

I must say that I don't quite understand why it was removed.

==> Scripts should be updated to use ternary operators instead.

So if I adhere to the recommendation, I should use this standard practice syntax:

CheckUpdate("UpdateTest" & (@Compiled ? ".exe" : ".au3"), $sVersion, "http://users.telenet.be/GreenCan/AutoIt/Updates/AppsUpdates.txt")

instead of

;CheckUpdate("UpdateTest" & _Iif(@Compiled, ".exe", ".au3"), $sVersion, "http://users.telenet.be/GreenCan/AutoIt/Updates/AppsUpdates.txt")

I don't think that it makes the code more understandable...

GreenCan


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

Hi guinness,

It is not yet removed from Misc.au3 (I guess to allow AutoIt members to have time to remove the code before the next release),  I admit it is now undocumented in the latest AutoIt release (not available anymore in the helpfile)

But in the previous v3.3.8.1 release (still used by a lot of people), it was still available in Helpfile.

I removed it in v3.3.12.0 (the latest), so as far as I'm concerned it's gone. _Iif() was there because ternary wasn't in previous versions of AutoIt, though is used in most programming langauges. As to the "issue" of readability, all you have to do is replace the two commas with ? : and remove the function name. If people have trouble understanding ternary, then I would avoid most programming languages.

Did you also see my edit about MsgBox()?


_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

#7 ·  Posted (edited)

I removed it in v3.3.12.0 (the latest), so as far as I'm concerned it's gone. _Iif() was there because ternary wasn't in previous versions of AutoIt, though is used in most programming langauges. As to the "issue" of readability, all you have to do is replace the two commas with ? : and remove the function name. If people have trouble understanding ternary, then I would avoid most programming languages.

Don't over-estimate occasional programmers (I am member of this category ;)).

Not every AutoIt member has experience with C++

I will change my code accordingly...

I didn't even notice the new version, I am still on v3.3.10.2. But although I am a daily user of AutoIt, my visits to the forum are not that regular... I am going to have a hard time again to get this upgrade done by my outsourcing partner (I have no admin rights on my business laptop...)

 

Did you also see my edit about MsgBox()?

Yes, now I did, thanks.

GreenCan

Edited by GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

The users who downloaded the first version can simply start the script again, and update to the latest version will be done automatically.

GreenCan

Edited by GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites
@@ Debug(383) : Update file found
@@ Debug(475) : Version info not available in Update file
@@ Debug(55) : @error 4
 
how to fix ?

Share this post


Link to post
Share on other sites

I removed it in v3.3.12.0 (the latest), so as far as I'm concerned it's gone. _Iif() was there because ternary wasn't in previous versions of AutoIt, though is used in most programming langauges. As to the "issue" of readability, all you have to do is replace the two commas with ? : and remove the function name. If people have trouble understanding ternary, then I would avoid most programming languages.

 

The problem I see with this is that there are UDFs out there, that people use, that use _Iif().  I found myself going through other people's code to replace the function.  Very tedious until I realized that all I had to do was include a simple compatability funciton.

Func _Iif($a, $b, $c)
    Return ($a ? $b : $c)
EndFunc

I personally think something as simple as that should have been maintained for backward compatability, but then again, the solution is also simple enough.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

but then again, the solution is also simple enough.

That pretty much sums it up. It's tedious to have a function such as that in the UDFs. As with regards to "backwards compatibility", AutoIt is a language that is constantly growing, so I pose the question of which AutoIt version should the UDFs support? How far back do you want to go? 3, 4, 7 years? Thankfully the UDFs that ship with each AutoIt setup work with that particular version, so if you miss _Iif() stick with the version that it was last seen in.

If you had concerns about this before then you should have spoken up during the beta stage!

Edited by guinness

_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

 

@@ Debug(383) : Update file found
@@ Debug(475) : Version info not available in Update file
@@ Debug(55) : @error 4
 
how to fix ?

 

Hi CVSz,

I am trying to understand what your problem is.

I assume you have tried to create your own script as my example does not have 475 lines?

First question, does the original example function correctly on your system?

@error 4, if you look into the function, you get the error if the version key is not found in the updater file (then an empty string "" is returned)

    $sNewVersion = IniMemoryRead($sINI_Data, $sFileToUpdate, "version", "")

The structure of the updater file (AppsUpdates.txt) for

      CheckUpdate("Mytest.au3", "1.0.0.0", "http:/mywebsite/Mytest.ini",1)

looks like this:

structure of "http:/mywebsite/Mytest.in for a new revision:

[Mytest.au3]                    ==> First parameter of CheckUpdate(), name of section

version=1.0.0.1               ==> This is the line that IniMemoryRead() does not find in your script. The version number set here corresponds to the line #AutoIt3Wrapper_Res_Fileversion=1.0.0.1 in your own updated script

date=2014/06/25 15:30  ==> any date in fact, just indicative

Filesize=xxxxxx                ==> File size in bytes returned by  AppsUpdates_Calculator.au3

CRC=xxxxxxxxx               ==> CRC calculation File size in bytes returned by  AppsUpdates_Calculator.au3

download=http://users.telenet.be/GreenCan/AutoIt/Updates/UpdateTest_1.0.1.1.au3 ==> url of the update script to download

Let me know if you got the issue fixed.

GreenCan


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

New Version 1.0.0.3 now includes View History of Changes function

see First post for more details and download.

The users who downloaded a previous version can simply start the script again, update to the latest version will be done automatically.

GreenCan


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

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

  • Similar Content

    • Greenseed
      By Greenseed
      Include this script to your actual project and when SUP_Check() is called your script is going to download the next version and self update him self then restart.

      I am sorry but i did not bother to make a UDF or a more user friendly and flexible module since i still have a lot to go on my initial project

      1- inside your project you include thoses line , all together and before your script actual code, beside your log system if you have one

      #include "self_update.au3" SUP_SetLogCallBack("_log") ; optional , used to send log to your allready log system if success self loggin is disable SUP_SetCheckCallBack("SUP_DownloadProgress") ; optional , will send the % of the download in progress SUP_Start("VALID HTTP URL To YPOUR NEW FILE","DOWNLOAD FULL FILE PATH NAME") ; mandatory
      2- Now anywhere in your script you call this line to check for a newer version
      $fileVersionUrl: is if your using a custom web page to send fast information on the file like version that optional, if empty will always update when check
      $parentGui="": the self updated will create a gui with a progress bar and try to attach it self to the $parentGui , that optional

      SUP_Check($fileVersionUrl="",$parentGui="")
      3- to check if your script has just restarted after a update

      if IsDeclared("updateComplete") then ConsoleWrite("Update Complete Sucess Bravo!") endif
      File: SUP_SelfUpdate.au3
      The script can be compiled alone for debug purpose , look for 1 line to uncomment inside the script if running alone

      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=e:SelfUpdate.exe #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include-once ;*************** Line to be use inside your own project************ ; ;~ #include "self_update.au3" ;~ SUP_SetLogCallBack("_log") ;~ SUP_SetCheckCallBack("SUP_DownloadProgress") ;~ SUP_Start("e:SelfUpdate_FF.exe",@TempDir&"SelfUpdate_FF.exe") ; ;******************************************************************* Global $SUP_LOGS_CALL[1] = [0] Global $SUP_DOWN_CALL[1] = [0] Global $SUP_URL Global $SUP_FILE Global $SUP_INFO_FILE Global $SUP_DEST_FILE Global $SUP_PID ;**************Uncomment to self debug that script alone************* ;~ SUP_Start(@ScriptDir&"SelfUpdate.exe",@TempDir&"SelfUpdate.exe") ;******************************************************************** Func SUP_Start($SUPURL,$SUPFILE) $SUP_URL = $SUPURL $SUP_FILE = $SUPFILE $SUP_INFO_FILE = $SUP_FILE&".info" if $CmdLine[0] > 0 Then Switch $CmdLine[1] case "update" SUP_InitInfo() if Not ProcessWaitClose($SUP_PID,30) Then SUP_Log("UPDATE - Could not complete since """&$SUP_DEST_FILE&""" will not close",false) Exit EndIf if Not FileCopy($SUP_FILE,$SUP_DEST_FILE,1) Then SUP_Log("UPDATE - Could not copy the new file to """&$SUP_DEST_FILE&"""",false) Exit EndIf Run($SUP_DEST_FILE&" updatecomplete") exit case "updatecomplete" SUP_Delete() ;~ SUP_Log("UPDATE - Complete sucess") Assign("updateComplete",true,2) EndSwitch ;~ Else ;~ SUP_Check() ;for testing to be remove when linked with main EndIf ;~ sleep(5000) EndFunc Func SUP_InitInfo() local $data = FileRead($SUP_INFO_FILE) $data = StringSplit($data,"|") if $data[0] <> 2 Or $data[1]="" or $data[2] = "" Then SUP_Log("UPDATE - Info File is invalid") sleep(4000) exit EndIf $SUP_PID = $data[1] $SUP_DEST_FILE = $data[2] EndFunc Func SUP_Delete() FileDelete($SUP_FILE) FileDelete($SUP_INFO_FILE) EndFunc Func SUP_SetCheckCallBack($funcCallBack) ReDim $SUP_DOWN_CALL[$SUP_DOWN_CALL[0]+2] $SUP_DOWN_CALL[0] += 1 $SUP_DOWN_CALL[$SUP_DOWN_CALL[0]] = $funcCallBack EndFunc Func SUP_Check($fileVersionUrl="",$parentGui="") ;~ if $RUN then return local $version = FileGetVersion(@AutoItExe) local $nextVersion = "always update" if $fileVersionUrl <> "" Then $nextVersion = BinaryToString(InetRead($fileVersionUrl,1)) ;~ SUP_Log($version&" "&$nextVersion) if $nextVersion = "" Or $version = $nextVersion Then SUP_Log("UPDATE - No new version found") Return EndIf SUP_Log("UPDATE - New version found") SUP_Log("UPDATE - Downloading version "&$nextVersion) local $size = InetGetSize($SUP_URL,1) FileDelete($SUP_FILE) local $handle = InetGet($SUP_URL,$SUP_FILE,1,1) local $byteRead, $error = false #include <WindowsConstants.au3> GUICreate("ProgressBar",200,30,-1,-1,BitOR($WS_MINIMIZEBOX,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST),$parentGui) local $progress = GUICtrlCreateProgress(0,0,200,30) GUISetState(@SW_SHOW) local $pct do Sleep(250) $byteRead = InetGetInfo($handle, 0) if @error Then $error = true ExitLoop EndIf GUICtrlSetData($progress,$byteRead*100/$size) $pct = Round($byteRead*100/$size,2) SUP_Log("UPDATE - Percent done: "&$pct) If $SUP_DOWN_CALL[0] > 0 Then For $i = 1 to $SUP_DOWN_CALL[0] Call($SUP_DOWN_CALL[$i],$pct) Next EndIf Until InetGetInfo($handle, 2) GUIDelete() if $error or Not InetGetInfo($handle,3) Then InetClose($handle) SUP_Log("UPDATE - Downloading next version failed") SUP_Delete() Return EndIf InetClose($handle) FileDelete($SUP_INFO_FILE) FileWrite($SUP_INFO_FILE,@AutoItPID&"|"&@ScriptFullPath) SUP_Log("UPDATE - Exiting to complete update") Run($SUP_FILE&" update") if @error Then SUP_Log("UPDATE - Unable to open the new file") SUP_Delete() Return endif SUP_Log("UPDATE - Exiting") sleep(1000) Exit EndFunc Func SUP_SetLogCallBack($funcCallBack) ReDim $SUP_LOGS_CALL[$SUP_LOGS_CALL[0]+2] $SUP_LOGS_CALL[0] += 1 $SUP_LOGS_CALL[$SUP_LOGS_CALL[0]] = $funcCallBack EndFunc Func SUP_Log($msg,$useCallBack=true) If $useCallBack And $SUP_LOGS_CALL[0] > 0 Then For $i = 1 to $SUP_LOGS_CALL[0] Call($SUP_LOGS_CALL[$i],$msg) Next Return EndIf if @Compiled Then MsgBox(0,"Message",$msg) ConsoleWrite($msg&@CRLF) EndFunc