Jump to content

FileInstall file Date Stamp check in memory


feeks
 Share

Recommended Posts

Can anyone tell me if it possible to obtain a file date stamp of a fileinstall()-ed file in memory without extracting the file first or pre-storing the source file date-stamp as some sort of information file for later checking.

I would like to avoid performing an extraction of the file unless the date stamp of the fileinstall()-ed file is newer than the equivalent destination file in an attempt to optimize code run-time.

Link to comment
Share on other sites

  • Moderators

feeks,

You do not need a separate file, you can always hardcode the timestamp as a Const in your compiled file. :graduated:

You would have to do this manually before compilation. I cannot think of a way to retrieve it as you compile and then store it within the exe - but someone else might if you can wait a bit. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

feeks,

You would have to run FileGetTime on the file you are FileInstalling beforehand. I would suggest setting the "format" parameter to 1 to get a string return:

ConsoleWrite(FileGetTime("File_Path", 0, 1) & @CRLF)

This will give you the returned value in the SciTE output pane in the form "YYYYMMDDHHMMSS".

Then you put it into your main script as a constant and do a comparison like this:

; Among your declarations
Global Const $MyFileTimeStamp = "YYYYMMDDHHMMSS" ; <<< the value you got from the step above, not the literal string!

; Then you look for the installed file timestamp
$sInstalledFileTimeStamp = FileGetTime("Where_you_think_it_should_be_path", 0, 1)
; And see if it is an earlier version
If Number($sInstalledFileTimeStamp) < Number($MyFileTimeStamp) Then
    ; You need to install your version
EndIf

Note that I converted the values to numbers before making the comparison - it might work with strings, but it is better to make an arithmetical comparison. :(

All clear? :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Love your work M23

I adapted your suggestion slightly by configuring the const to the FileGetTime() of the source exe as FileInstalled against the locally stored copy and it worked a treat public/style_emoticons/autoit/rolleyes.gif

feeks

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...