Hello Guest it is July 16, 2019, 11:10:45 PM

Author Topic: Check for Update Script  (Read 2491 times)

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

*
  •  747 747
  • DazTheGas
    • View Profile
Check for Update Script
« on: July 09, 2015, 04:58:32 AM »
well 2522 was out for a while before I new about it so I did this so I could always be up to date. just put it in a button or function somewhere.

Code: [Select]
     local inst = mc.mcGetInstance();

        local file = wx.wxFileSystem():OpenFile('http://www.machsupport.com/software/downloads-updates/#tabs-2')
        if not file then
            wx.wxMessageBox("Update Check is Broken") return
        end
        local data = file:GetStream()
        local text = {}
        repeat
            local c= data.C
            if data:LastRead() ~= 0  then
                if c > 0 then text[#text+1]=string.char(c) end
            end
        until data:LastRead() == 0
        local web = table.concat(text)
        local vers = string.sub(tostring(mc.mcCntlGetVersion(inst)),-4)
        if string.find (web, vers)then
        wx.wxMessageBox('Mach4 is upto date');
        else
        wx.wxMessageBox('Theres a different version of Mach4 to Download')
        end
   

DazTheGas
Theres always time for a choccy biccy

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Check for Update Script
« Reply #1 on: July 09, 2015, 05:49:39 AM »
cleaver bugger
Re: Check for Update Script
« Reply #2 on: July 10, 2015, 01:29:24 AM »
Sweet :)

Offline Chaoticone

*
  • *
  •  5,524 5,524
  • Precision Chaos
    • View Profile
Re: Check for Update Script
« Reply #3 on: July 10, 2015, 05:50:25 AM »
That is pretty awesome! Thanks for sharing!  :)

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Check for Update Script
« Reply #4 on: August 14, 2015, 10:08:56 AM »
Wow.  Your program is so simple and clean!  Fantastic work.   If i might ask one question > . .  the statement  ' local data = file:GetStream() ' is very powerful , is there a reciprocal  'SendStream()' function ? I have studied the WXWidgets Docs but cannot find a way to 'send out' ethernet data from mach4.

Thanks in Advance,

And please consider doing more of your programmer  utilities.




Offline DazTheGas

*
  •  747 747
  • DazTheGas
    • View Profile
Re: Check for Update Script
« Reply #5 on: August 14, 2015, 10:55:48 AM »
The wx.wxFileSystem() will only allow the reading of files from any local or external address including an archive.

DazTheGas
Theres always time for a choccy biccy