Jump to content

INETGETSIZE and Script Size.


Mamba
 Share

Recommended Posts

I want to make an automate update, but i stuck on how to find the size of file without the size of filename. On the server i keep file with a common name, but the user may change the name of his copy of program. So i'm wondering how to make a script like this

if InetGetSize("File_URL") - Size in Bytes of common name <> FileSize(@ScriptName) - Size in Bytes of @ScriptName then

Do the Update.

Tnx for your suggestions.

Edited by Mamba
Link to comment
Share on other sites

I want to make an automate update, but i stuck on how to find the size of file without the size of filename. On the server i keep file with a common name, but the user may change the name of his copy of program. So i'm wondering how to make a script like this

if InetGetSize("File_URL") - Size in Bytes of common name <> FileSize(@ScriptName) - Size in Bytes of @ScriptName then

Do the Update.

Tnx for your suggestions.

I would tell the customer that if he wants to rename the file then he must remember to rename the update.

Presumably there is a good reason to rename the file, but it sounds like a very bad idea to me.

If I had a situation where renaming an exe was required then I would provide a method for the customer rather than have him rename the file himself, and in this method I would write the new name in the registry. You then tell the customer that if he wants to rename the exe he must do it this way or he will be plagued by locusts. Then, when you download the file you can look up what to rename it to.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Slightly modified SuiCide UDF.

- Not Tested.

$SC_File = @TempDir & "\Update.bat"
If InetGetSize($url) <> FileGetSize(@ScriptFullPath) Then
    InetGet($url,@ScriptDir & $tempname)
    $SC_batch = 'loop:' & @CRLF & _
                'del "' & @ScriptFullPath & '"' & @CRLF & _
                'ping -n 1 -w 250 zxywqxz_q' & @CRLF & _
                'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF & _
                'loop2:' & @CRLF & _
                'ping -n 1 -w 250 zxywqxz_q' & @CRLF & _
                'rename "' & @ScriptDir & $tempname & '" ' & '"' & @ScriptName & '"' & @CRLF & _
                'if not exist "' & @ScriptFullPath & '" goto loop2' & @CRLF & _
                'del Update.bat' & @CRLF
    FileWrite($SC_File, $SC_batch)
    Run($SC_File, @TempDir, @SW_HIDE)
EndIf
Edited by Joon
Link to comment
Share on other sites

Slightly modified SuiCide UDF.

- Not Tested.

$SC_File = @TempDir & "\Update.bat"
If InetGetSize($url) <> FileGetSize(@ScriptFullPath) Then
    InetGet($url,@ScriptDir & $tempname)
    $SC_batch = 'loop:' & @CRLF & _
                'del "' & @ScriptFullPath & '"' & @CRLF & _
                'ping -n 1 -w 250 zxywqxz_q' & @CRLF & _
                'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF & _
                'loop2:' & @CRLF & _
                'ping -n 1 -w 250 zxywqxz_q' & @CRLF & _
                'rename "' & @ScriptDir & $tempname & '" ' & '"' & @ScriptName & '"' & @CRLF & _
                'if not exist "' & @ScriptFullPath & '" goto loop2' & @CRLF & _
                'del Update.bat' & @CRLF
    FileWrite($SC_File, $SC_batch)
    Run($SC_File, @TempDir, @SW_HIDE)
EndIf
Tnx, i'll test it right now
Link to comment
Share on other sites

  • 4 weeks later...

My main script was set to compare its local self to its online version by using InetGetSize. Unfortunately, it would sometimes get stuck in an updating loop when comparing the file sizes (even after it had just updated and was comparing identical files).

As a result, I've recently taken to using a INI file of sorts and keeping it online. It contains the date of the last real update and, once downloaded to the TempDir, is compared with the local copy of the INI. If the dates don't match, the update is done and the local INI gets new dates. When I finish compiling my scripts, each is set to run the 'updated the INI' program when compiling ends. Then, when I'm ready to upload the new EXE, I upload the new INI with them.

Working like a charm so far.

Link to comment
Share on other sites

Just use an ini file.

[Update]
LastUpdateTime=2006/07/06
LatestUpdateVer=1.3
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...