mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
i've found a download script that will basically search online for new downloads to remote scripts, and download them to to a folder in mirc, e.g, downloaded/bluetheme.mrc

what exactly should i do when it's downloaded, i want to replace my current bluetheme.mrc with this new downloaded/bluetheme.mrc

i also want to be safe because i want the switch to work whilst im in channels, whilst im in remote editor, etc etc etc

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
1) Overwrite your old script (or have it make a backup, then overwrite it)

2) /unload -rs your script

3) /load -rs the overwritten script


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
thanks for the instant reply mate!

i don't understand what you mean by overwrite the old script

the new scripts will be downloaded to the 'downloaded' folder


so all i have to do is point 2/3?

edit* I saw this in mirc help for /load

If you try to load a file that is already loaded, it's contents are updated and it's position in the alias/script processing order is maintained.

so do i really need to /unload?

Last edited by pouncer; 19/01/08 11:41 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
First, yes, you want to overwrite the script that is currently loaded. If you don't, you won't be "updating" the script.

Second, you need to do /unload because if you just do /load and the scripts editor is opened and that file is selected and then you press OK, it will save the script as the original again. If it's unloaded then reloaded, it won't have that problem.


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
Originally Posted By: Riamus2
First, yes, you want to overwrite the script that is currently loaded. If you don't, you won't be "updating" the script.


overwriting the currently loaded script, so when reading the data through sockread i should be writing to this currently loaded script?

isnt this dangerous?

i was initially thinking something like:

1) an update is required to replace bluetheme.mrc
2) download updated bluetheme.mrc to some folder
3) unload bluetheme.mrc
4) move download/bluetheme.mrc to scriptdir and load that

Last edited by pouncer; 20/01/08 05:36 PM.
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
The method I've been using for the past year is as Riamus stated.

First I gather the list of files to update. Then I open a seperate socket for each file. On Sockopen I /write -c file.mrc.
Then I /write file.mrc $1- each line. Then either on sockclose or after total bytes have been reached, I /load file.mrc.

mIRC keeps the file in memory, so until you load the new file it is still running the old one.

I've had this method in affect for over a year and used by people of all skill levels. From a better scripter than I, to a grandma/grandpa.

Last edited by DJ_Sol; 20/01/08 05:55 PM.
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Writing to a new file first is advisable.

Writing directly to the existing script from the sockread event has big potential to cause issues if the download is corrupted or interrupted. Ideally you should:

1) Write to a separate file first.

2) Perform a validity check to ensure the download wasn't corrupted - ie. calculate a $crc/$md5/$sha1 digest for the new file and compare it with one stored on the server.

3) Optionally create a copy of the old script as a backup.

4) Overwrite the old script with the new one.

5) Perform your /load's.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
i think that seems much more safe starbuck, but what do i do a $md5/$crch check off? could you expand on this part more as it seems interesting

something like store $md5(size of file) on server
the when file is downloaded compute this on client, and compare both values?

Last edited by pouncer; 20/01/08 06:37 PM.
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Quote:
something like store $md5(size of file) on server
the when file is downloaded compute this on client, and compare both values?

Yes except you want the MD5 digest of the entire contents of the file rather than its size, so you'd use $md5(filename, 2) in mIRC.

Basically you just want to store a text file listing each of your script's filenames along with their MD5 digest. Then you download this extra file along with the new scripts and go through each line comparing $md5(filename, 2) with the value in the file.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Just as a note, I was not stating that you should overwrite the original file *while* downloading the updated one. I was only telling you to overwrite it. It was implied that this was done after downloading the file, but I guess I should have stated that clearly. Yes, you can delete then copy the file. However you do it, you're essentially overwriting it.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2008
Posts: 16
J
Pikka bird
Offline
Pikka bird
J
Joined: Jan 2008
Posts: 16
just unload the old script and load the new one


Link Copied to Clipboard