Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2006
    Posts
    44

    IF or ELSE based on version?

    Hello guy, I'm not sure if this can be done or not but here goes. I want to add a gray button called "Update" that will change color if there is a newer version of the project.

    I was thinking of using the IF or ELSE feature but I did not see any way to check the version. not only that I would have to have the program ask the website at start up what the up-to-date version was.

    Hay any one tried to do this, or can this even be done?

  2. #2
    Join Date
    Feb 2005
    Location
    Germany
    Posts
    135
    Hello, I do such with the following:

    1. Download the updatefile from a server, which contains the updateinformations (e.g. the newest version of your program)

    2. Read the downloaded file with TextFile.ReadToString and every of my programs have a integrated number (e.g. program.v1.0.0)

    3. Then compare TextFile.ReadToString with the integrated number

    4. If TextFile.ReadToString isn't the integrated number, then a newer version exists

    Examplecode:

    Code:
    HTTP.Download("http://www.mydomain.com/updatefile.txt", _TempFolder .. "\\updatefile.txt", MODE_BINARY, 20, 80, nil, nil, nil);
    if TextFile.ReadToString(_TempFolder .. "\\updatefile.txt") ~= "program.v1.0.0" then
    	Dialog.Message("Newer version available", "A newer version is available!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    else
    	Dialog.Message("Newer version available", "You are up to date!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end
    Last edited by nrgyzer; 04-15-2006 at 06:52 AM.

  3. #3
    Join Date
    Oct 2004
    Location
    East, South & West Asia
    Posts
    1,020
    Quote Originally Posted by nrgyzer
    Hello, I do such with the following:

    1. Download the updatefile from a server, which contains the updateinformations (e.g. the newest version of your program)

    2. Read the downloaded file with TextFile.ReadToString and every of my programs have a integrated number (e.g. program.v1.0.0)

    3. Then compare TextFile.ReadToString with the integrated number

    4. If TextFile.ReadToString isn't the integrated number, then a newer version exists

    Examplecode:

    Code:
    HTTP.Download("http://www.mydomain.com/updatefile.txt", _TempFolder .. "\\updatefile.txt", MODE_BINARY, 20, 80, nil, nil, nil);
    if TextFile.ReadToString(_TempFolder .. "\\updatefile.txt") ~= "program.v1.0.0" then
    	Dialog.Message("Newer version available", "A newer version is available!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    else
    	Dialog.Message("Newer version available", "You are up to date!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end

    This is nice work.....nrgyzer
    Newbie Examples
    ------> AMS 7.5 : amstudio.azman.info
    ----> AMS 6 & 5: www.azman.info/ams/
    ----> FB: facebook.com/GuideToWealth

    ----> Content Development Blog: www.AZMAN.asia

  4. #4
    Join Date
    Apr 2005
    Posts
    172
    very nice

  5. #5
    Join Date
    Apr 2006
    Posts
    44
    Thank you so much nrgyzer, you are a code ninja...

    I did change the code abit to fit my needs but that worked out really nice thanks. I made labels and set them to disabled and then I made paragraphs and set them so they would not be visible if or else. This way I could make a new page called update then "On Show" I added my code there that way I could show the text that applied depending on the version and hide the other text.
    Code:
    HTTP.Download("http://www.mydomain.com/updatefile.txt", _TempFolder .. "\\updatefile.txt", MODE_BINARY, 20, 80, nil, nil, nil);
    if TextFile.ReadToString(_TempFolder .. "\\updatefile.txt") ~= "program.v1.0.0" then
    	Paragraph.SetVisible("updates-yes", true);
    	Label.SetEnabled("download-updates", true);
    	Label.SetEnabled("label-treasure-updates", true);
    else
    	Paragraph.SetVisible("updates-no", true);
    end

Similar Threads

  1. Unable to find software?
    By NigelLacey in forum Visual Patch 2.0
    Replies: 4
    Last Post: 10-11-2005, 10:35 AM
  2. Replies: 1
    Last Post: 06-07-2004, 10:16 AM
  3. HOWTO: Open a Version 3.0 Project in Version 4.0
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-30-2002, 02:09 PM
  4. HOWTO: Detect Acrobat Version
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-22-2002, 04:01 PM
  5. INFO: Moving from the Trial Version to Commercial Version
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-07-2002, 08:52 AM

Posting Permissions

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