Results 1 to 5 of 5

Thread: Procedure Update(URL : string);

  1. #1
    Join Date
    Jun 2012
    Posts
    586
    Mentioned
    112 Post(s)
    Quoted
    296 Post(s)

    Default Procedure Update(URL : string);

    I'll try to keep this short...

    I'm sure many of you have seen updaters. Y'know, when someone posts a script, but they don't post the actual script; They post a script that downloads the most recent public copy of that script ( @fady;'s Ivy Chop-O-Matic, for example).

    Update.simba solves this crap. Put simply, it does this:
    • Retrieves the online copy of the script
    • Compares it with the currently running script and if it has changed:
      • Overwrites the current script with the newer
      • Creates a .bat that:
        • Kills the current Simba by PID
        • Launches a new Simba and runs the script with:
          Code:
          AppPath + AppFile() + ' -o ' + ScriptPath + ScriptFile + ' -r'
        • Deletes itself


    Now you can run a script. If there's an update, it'll automatically download and run the newer script! A bit "hackish", but works mint (from my experiences).

    This works with other Simbas, even if you've renamed yours to, say, Simba_Old.exe. See below.



    Update.simba provides:
    • AppFile() - Similar to ScriptFile, but provides the currently running Simba executable
    • TInputPipeStream.ReadAnsiString() - The default is broken and doesn't return correct values
    • Update() - Updates your current script from a URL if an update is needed




    Want proof? Save and run this!
    Simba Code:
    program UpdateExample;
    {$I Update.simba}

    const
      VERSION := 1.0;

    begin
      Update('http://pastebin.com/raw/TdCiPkAr');
      WriteLN('Version: ', VERSION);
    end.



    Thoughts? I'm sure there are better ways but meh, was fun to learn and use TProcess and such. . Tried to make it easy enough to read.
    Last edited by Obscurity; 03-30-2016 at 11:53 PM.




    Skype: obscuritySRL@outlook.com

  2. #2
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

  3. #3
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    Soo... now we need to have nubs download prosocks and this 'include' file, place it in the correct spot, and then download an updater?

    ive considered doing an updater like this, but... the thing is... if someone cant read 'script downloaded to /path/to/script.simba, please open and run' and then do it, should they really even be using simba?

    also, on 105, you dont need the proceeding file://
    thats all i read.

  4. #4
    Join Date
    Jan 2012
    Location
    East Coast
    Posts
    733
    Mentioned
    81 Post(s)
    Quoted
    364 Post(s)

    Default

    Quote Originally Posted by Turpinator View Post
    Soo... now we need to have nubs download prosocks and this 'include' file, place it in the correct spot, and then download an updater?

    ive considered doing an updater like this, but... the thing is... if someone cant read 'script downloaded to /path/to/script.simba, please open and run' and then do it, should they really even be using simba?

    also, on 105, you dont need the proceeding file://
    thats all i read.
    Just needs ProSocks which arguably should be included in Simba already, and the functions could easily be included in SRL-6.

    Good work Obs.

  5. #5
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    I created something similar couple years ago.

    https://villavu.com/forum/showthread...77#post1314377

    Good work

    -Home

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •