Jump to content
Sign in to follow this  
damian666

Would like some help on my reload script- solved

Recommended Posts

damian666

i made a reloader, which main purpose is to see if the size of files differ and if they do, reload them with my custom resources.

The patching stuff works great, but whatever i do i cant get the reloader to see the difference.

i first check the file in my system, and put that in "$size1"

Then i check the register for the second size, the patched size that i stored there on the installment "$size2".

Now i only have to see if they differ right?

Like " If not $size1 = $size2 then..."

Didnt work for me man.

I will post my script, so maybe soemone can help.

#cs ----------------------------------------------------------------------------

 Author:         Damian666

 Script Function:
    Silent Reloader

#ce ----------------------------------------------------------------------------
;Tray options
Opt("TrayMenuMode",1)
TrayTip("Reloader", "Checking and/or reloading files ...", 30, 1)
;Tray options end

;Install needed files and directories
FileInstall("Tools\reshacker.exe", @ScriptDir & "\")
DirCreate(@ScriptDir & "\NewFiles")
    
$section=1
    $yes=0
    
    While 1
        $file = IniReadSection(@ScriptDir & "\Tools\filelist.ini", $section)
        If @error Then ExitLoop
        
        For $i = 1 To $file[0][0]
                        
            $size1=FileGetSize($file[$i][1]);==>Get size from file in system
            $size2=RegRead("HKEY_LOCAL_MACHINE\Software\FilePatcher\Filesize\", $file[$i][0])
            
;Debug
;MsgBox(0, "", "1:" & $file[$i][0] & " " & $size1,3)
;MsgBox(0, "", "2:" & $file[$i][0] & " " & $size2,3)
                
            If $size1 = $size2 Then
                $yes=0
            Else
                $yes=1
            EndIf
            
            If $yes = 1 Then
                For $i = 1 To $file[0][0]
                        
        ;Copy, patch and modifype
                    FileCopy($file[$i][1], @ScriptDir & "\Backup\")
                        
                    If FileExists(@ScriptDir & "\Resources\" & $file[$i][0] & "\" & Lang() & $file[$i][0] & ".txt") Then
                        RunWait (@ScriptDir & "\ResHacker.exe" & " -script " & '"' & @ScriptDir & "\Resources\" & $file[$i][0] & "\" & Lang() & $file[$i][0] & ".txt" & '"')                
                    Else
                        RunWait (@ScriptDir & "\ResHacker.exe" & " -script " & '"' & @ScriptDir & "\Resources\" & $file[$i][0] & "\" & $file[$i][0] & ".txt" & '"')
                    EndIf
                        
                    If FileExists(@ScriptDir & "\NewFiles\" & $file[$i][0]) Then
                        RunWait(@ScriptDir & "\Tools\modifyPE.exe" & " " & '"' & @ScriptDir & "\NewFiles\" & $file[$i][0] & " -c" & '"', @ScriptDir, @SW_HIDE)
                            
                        $size=FileGetSize(@ScriptDir & "\NewFiles\" & $file[$i][0])
                        
                        FileMove(@ScriptDir & "\NewFiles\"& $file[$i][0], $file[$i][1] & ".new")
                            
                        RunWait(@ScriptDir & "\Tools\MoveEx.exe" & " " & '"' & $file[$i][1] & ".new" & '"' & " " & '"' & $file[$i][1] & '"', @ScriptDir, @SW_HIDE)
                        
                    EndIf
            
                Next
            
            EndIf
                
        Next
        
        $section +=1
        
    WEnd
    
If $yes = 0 Then
    TrayTip("Reloader", "No files need reloading ...", 30, 1)
    Sleep(5000)
Else
    TrayTip("Reloader", "Files were reloaded", 30, 1)
EndIf

;===================================================================================================



==========
Func Lang();==> Get Windows Language
Select
    Case StringInStr("0413,0813", @OSLang)
        Return "NL-"

    Case StringInStr("0409,0809,0c09,1009,1409,1809,1c09,2009,2409,2809,2c09,3009,3409", @OSLang)
        Return "EN-"

    Case StringInStr("0407,0807,0c07,1007,1407", @OSLang)
        Return "DE-"

    Case StringInStr("040a,080a,0c0a,100a,140a,180a,1c0a,200a,240a,280a,2c0a,300a,340a,380a,3c0a,400a,440a,480a,4c0a,5



00a", @OSLang)
        Return "SP-"

    Case Else
        Return "Other (can't determine your language)"

    EndSelect
EndFunc;==> Get Windows Language end
Edited by damian666

and proud of it!!!

Share this post


Link to post
Share on other sites
enaiman

Are these 2 lines

;MsgBox(0, "", "1:" & $file[$i][0] & " " & $size1,3)

;MsgBox(0, "", "2:" & $file[$i][0] & " " & $size2,3)

displaying the same thing and the test "If $size1 = $size2 Then" fails?

If so - you have to be sure that you're testing the values of the same type: FileGetSize returns a number, not sure what RegRead returns, so you better convert its return to a number, something like:

$size2=Number(RegRead("HKEY_LOCAL_MACHINE\Software\FilePatcher\Filesize\", $file[$i][0]))

Not sure if it works but this is the solution when that kind of test fails.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
FireLord

@topic starter:

change your name loser.


[center]See the Helpfile[/center]
While Alive()
	 DrinkWine();
}
[center][/center]

Share this post


Link to post
Share on other sites
damian666

@firelord, you have been reported dude.

no need to flame me...

its my username, not yours

damian666


and proud of it!!!

Share this post


Link to post
Share on other sites
damian666

yes, those debuglines display the same value, but still it fails to see it as the same???

weird huh?

but i am going to try your suggestion.

thanx and i will let you know.

damian666


and proud of it!!!

Share this post


Link to post
Share on other sites
damian666

thanx gary, appriciate it.

damian666


and proud of it!!!

Share this post


Link to post
Share on other sites
damian666

first tests are positive, thanx man, i didnt knew that option.

learned again!!

i will report back friday, will test tonight on my test system.

thanx again dude.

damian666


and proud of it!!!

Share this post


Link to post
Share on other sites
damian666

OK, it worked man, thanx for the help.

Solved.

damian666


and proud of it!!!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.