mIRC Home    About    Download    Register    News    Help

Print Thread
#6240 12/01/03 11:21 AM
Joined: Dec 2002
Posts: 11
R
Pikka bird
OP Offline
Pikka bird
R
Joined: Dec 2002
Posts: 11
My question is:
If i do a new release of my script I just want the script [on start] check if there is a new version of thew script online [http://....] and in case of positive reply ask for the download, in case of a negative reply puts an echo [no new version]...

Can any1 help me?

#6241 12/01/03 12:31 PM
Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
/help sockets
www.google.com and search for http protocol rfc


Code:
//if ( khaled isgod ) echo yes | else echo no
#6242 12/01/03 12:49 PM
Joined: Dec 2002
Posts: 11
R
Pikka bird
OP Offline
Pikka bird
R
Joined: Dec 2002
Posts: 11
i know a little sockets, but if i had knew how to do the script...

#6243 12/01/03 03:49 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
The simplest way to do what you want is to put a version text file on your web site that just contains a line that has the version number (or build number) <space> URL link to the file, followed by a blank line. It's a simple matter to then open a socket to your web site, GET that file and compare the value found against the current version/build that's in use, stored inside your script somewhere, such as in a variable, in an .ini file or in a hash table entry.
Code:

on *:START: sockopen VersionCheck.YourScriptName www.mysite.com 80
on *:SOCKOPEN:VersionCheck.YourScriptName: sockwrite -n $sockname GET /path/to/MyVersion.txt
on *:SOCKREAD:VersionCheck.YourScriptName:{
  var %version
  sockread %version
  tokenize 32 %version
  if ($1 &gt; %Version.MyScript) echo 4 -ati2 * A newer version exists. Download it at $2
  sockclose $sockname
}

MyVersion.txt
12345 http[/b]://www[/b].mysite.com/downloads/MyScript-12345.zip
<blank line>


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#6244 12/01/03 05:15 PM
Joined: Dec 2002
Posts: 11
R
Pikka bird
OP Offline
Pikka bird
R
Joined: Dec 2002
Posts: 11
thank you!!!!

#6245 15/01/03 10:14 AM
Joined: Jan 2003
Posts: 1
N
Mostly harmless
Offline
Mostly harmless
N
Joined: Jan 2003
Posts: 1
Good script!
But if there is a new versione i'd like it opens a dialog in wich i have "new script! do you want to download it?" with 2 buttons, "yes" and "no".

If i click yes it have to download the new script.

Is it possible?

#6246 15/01/03 10:25 AM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Something like:
Code:
on *:START: sockopen VersionCheck.YourScriptName www.mysite.com 80
on *:SOCKOPEN:VersionCheck.YourScriptName: sockwrite -n $sockname GET /path/to/MyVersion.txt
on *:SOCKREAD:VersionCheck.YourScriptName:{
  var %version  
  sockread %version  
  tokenize 32 %version  
  sockclose $sockname
  if ($1 &gt; %Version.MyScript) {
    if ( $input(YourScriptName has been updated $+ $chr(44) goto the website?,y,Update available) == $true ) {
      run http://website.com/download.html
    }
  }
}

#6247 15/01/03 03:01 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Since that on SOCKREAD is a running event, you can't halt it to ask for input; you would have to put the $input inside an alias and call the alias (using the URL as a parameter to that alias) on a timer to get it "out of the event." I would also suggest storing the new script URL in your script somewhere in case they don't wish to upgrade right then - they could click on an upgrade button somewhere and have it download the script. smile


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#6248 15/01/03 03:09 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Mmm? It worked for me fine..only problem was I had to put /sockclose first.


Link Copied to Clipboard