Jump to content

How to change GUI icon and EXE icon


Death259
 Share

Recommended Posts

1) GUISetIcon("D:\AutoIT\difference.ico")

2) When you use the compiler from the AutoIt program folder you get the option to use a different icon.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

This a very general question, but i was wanting to add an update function to my program so that it checks to see if the program is the latest version.

so like i would host it on my webspace and then people could download it from there install it using the installer i made. Then within the program there would be a menuitem that would check for the latest version and if there is a newer version then it would replace the current.

What's the general way to go about this?

Edited by Death259
Link to comment
Share on other sites

This a very general question, but i was wanting to add an update function to my program so that it checks to see if the program is the latest version.

so like i would host it on my webspace and then people could download it from there install it using the installer i made. Then within the program there would be a menuitem that would check for the latest version and if there is a newer version then it would replace the current.

What's the general way to go about this?

You could store the version # in a INI (written upon startup of the program). Store another INI on the web for a version that is higher or equal to the one already out. Then do a InetGet() for the INI on the web, compare the value with that of the stored INI on the computer, and download a newer version if necessary. Just don't forget to delete the INI downloaded from the web afterward. :whistle:

There are many ways to do it, I imagine. Just need to think a bit.

Link to comment
Share on other sites

alright that would work, thanks i just didn't know how to really check on the web for the version, but placing it in the ini and then using inetget sounds like it will definately solve the problem. i've never used initget() before. But thanks alot! i will do this and return if i have anymore questions.

Edited by Death259
Link to comment
Share on other sites

alright that would work, thanks i just didn't know how to really check on the web for the version, but placing it in the ini and then using inetget sounds like it will definately solve the problem. i've never used initget() before. But thanks alot! i will do this and return if i have anymore questions.

It's pretty simple to do. I've written some code for the exact thing you are needing and posted it in the forums. Here's something to get ya started, or to give you an idea of what you need to do:

;$CURRENT = "the web address to the new(er) file"
;$CVER = "the webaddress to the INI with current version in it"
;$INI = path to the INI on computer with version in it
;$DLDIR = path to save the newer version

;$sd = server is down if 1
;$nv = new version is available if 1
Case $msg = $BUTTON
            Dim $sd = 0
            Dim $nv = 0
            
            ;retrieve INI from web and place in the script dir as "check.ini"
            Dim $d = InetGet($CVER, @ScriptDir & "\data\check.ini")
            
            If $d = 0 Then
                MsgBox(16, "Error", "Cannot connect to server.  Please check internet settings!")
                FileDelete(@ScriptDir & "\data\check.ini")
                $sd = 1
            EndIf
            
            If $sd = 0 Then
                ; INI downloaded from web; getting version number
                Dim $c_Ini = IniRead(@ScriptDir & "\data\check.ini", "Data", "Ver", "")
                ; INI written by program on startup
                Dim $this_Ini = IniRead($INI, "Data", "Ver" , "")
                
                ; compares version numbers
                If $this_Ini < $c_Ini Then
                    $nv = 1
                ElseIf $this_Ini = $c_Ini Then
                    $nv = 0
                EndIf
                
                If $nv = 1 Then
                    Dim $size = InetGetSize($CURRENT)
                    
                    If $size < 100000 Then ;retrieves webpage instead of file if small size - only have this here because the file I used was on geocities free :-)
                        Msgbox(16, "Error", "Download server is down.  Please try again later.")
                        FileDelete(@ScriptDir & "\data\check.ini")
                        $sd = 1
                    EndIf
            
                    If $sd = 0 And $nv = 1 Then
                        Dim $kb = Round($size / 1024, 0) ;convert to kilobytes and chop off decimal places
                        $m1 = MsgBox(4, "New version available", "New version(" & $c_Ini & ") is " & $kb & "kb.  Download?")
                        If $m1 = 6 Then ;Yes
                            Dim $dl = InetGet($CURRENT, $DLDIR, 1, 1)
                            If $dl = 0 Then
                                MsgBox(16, "Error", "Cannot connect to server.  Please check internet settings!")
                            EndIf
                            ProgressOn("Downloading...", "Retrieving new version.")
                            While @InetGetActive
                                Dim $p = (100 * @InetGetBytesRead) / $size
                                ProgressSet($p, @InetGetBytesRead & "/" & $size & " bytes", "Download in progress.")
                                Sleep(250)
                            WEnd
                            ProgressOff()
                            FileDelete(@ScriptDir & "\data\check.ini")
                            MsgBox(64, "Done", "The file was downloaded to: " & $DLDIR)
                        EndIf
                    EndIf
                ElseIf $nv = 0 Then
                    MsgBox(64, "Update complete", "No newer version available.")
                    FileDelete(@ScriptDir & "\data\check.ini")
                EndIf
            EndIf

Inis have this format in the above:

[Data]

Ver=1.0 (or 1.2, 1.3, etc.)

Edited by Somniis
Link to comment
Share on other sites

well, i just finally implemented that code. Thank you soo much. that worked perfectly, and was better then what i had even thouhgt of implementing. I'd also never used the progress bar before, so this was a nice way to show me how to use both properly. The only thing i really changed, was that i just checked the donloaded ini with the $version number i had within the program itself, but it worked like a charm. Thanks man.

Edited by Death259
Link to comment
Share on other sites

well, i just finally implemented that code. Thank you soo much. that worked perfectly, and was better then what i had even thouhgt of implementing. I'd also never used the progress bar before, so this was a nice way to show me how to use both properly. The only thing i really changed, was that i just checked the donloaded ini with the $version number i had within the program itself, but it worked like a charm. Thanks man.

I'm glad I could help. ;) I'm sure there are even better ways to do what the above code does, but it works.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...