Sign in to follow this  
Followers 0
Victorique

Multiple GUI.

7 posts in this topic

Hello.

I-i, I have a program here, and I would like to use multiple action listeners for it. As it is now, all 3 Ui's are made at start and hidden, Shown when asked to, then hidden. I read http://www.autoitscript.com/wiki/Managing_Multiple_GUIs But didn't really Understand much. I also know of "GUISwitch" But don't know how it works.

I am just wondering if there are any example you can give me based on my code to help me.

My first post :unsure:

Here is my Program code (sorry if it is much, i don't know what Snippet to use):

If I have missed something in the FAQ or good example, Please excuse me :sweating:

#NoTrayIcon
#RequireAdmin
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=C:\Users\Accelerator\Desktop\Quicklaunch.exe
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
;#include <_UskinLibrary.au3>
;#include <Skins/XXX.au3>
;#include <DesuSplash2.au3>
#include <Crypt.au3>
;#region ### Thweme load section (may select soon) ### Form=
;_Uskin_LoadDLL()
;_Uskin_Init(_XXX(True))
;#endregion ### Thweme load section (may select soon) ### Form=

;#region ### Splash screen ### start=
;SplashImageOn("Desu Splash", _DesuSplash2(True), 650, 303, -1, -1, 1)
;Sleep(5000)
;SplashOff()
#endregion ### Splash screen ### start=

$hParent = GUICreate("parent");not shown
GUISetState(@SW_DISABLE, $hParent)
GUISetState(@SW_HIDE, $hParent)
#region ### START Koda GUI section ### Form=
$maingui = GUICreate("Quick launch V1.5", 225, 315, 470, 34, $WS_DLGFRAME, -1, $hParent)
$Firefox = GUICtrlCreateButton("Cyberfox", 0, 0, 105, 49)
$File = GUICtrlCreateMenu("File")
$Edit = GUICtrlCreateMenuItem("Edit program", $File)
$Reset = GUICtrlCreateMenuItem("Reset Configuration file", $File)
$admin = GUICtrlCreateMenuItem("Enter Admin key", $File)
$Edi = GUICtrlCreateMenu("Edit")
$Edit_Config = GUICtrlCreateMenuItem("Edit Config file", $Edi)
$Drive_Letter = GUICtrlCreateMenuItem("Change Drive letter", $Edi)
$Scite = GUICtrlCreateButton("Scite", 120, 0, 105, 49)
$PaleMoon = GUICtrlCreateButton("Pale moon", 0, 56, 105, 49)
$STS = GUICtrlCreateButton("STS", 120, 56, 105, 49)
GUICtrlSetTip($STS, "Eclipse")
$Notepad = GUICtrlCreateButton("notepad++", 0, 112, 105, 49)
$Skype = GUICtrlCreateButton("Skype", 120, 112, 105, 49)
$Exit = GUICtrlCreateButton("Exit", 120, 224, 105, 49)
$Thunderbird = GUICtrlCreateButton("Thunderbird", 120, 168, 105, 49)
$Tomcatui = GUICtrlCreateButton("Tomcat", 0, 168, 105, 49)
$SQLyog = GUICtrlCreateButton("SQLyog", 0, 224, 105, 49)
Dim $maingui_AccelTable[7][2] = [["{F1}", $Firefox],["{F2}", $Scite],["{F3}", $PaleMoon],["{F4}", $STS],["{F5}", $Notepad],["{F6}", $Skype],["{F7}", $Tomcatui]]; 2 dimentinal array to create keyboard shortcuts using "F" keys
GUISetAccelerators($maingui_AccelTable)
GUISetState(@SW_SHOW)

; Second GUI
$Select = GUICreate("select Drive", 131, 120, 192, 124, $WS_DLGFRAME, $ES_READONLY)
$Drive_ID = GUICtrlCreateCombo("Select Drive", 8, 8, 113, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
$combobox = GUICtrlSetData(-1, "A:|B:|C:|D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P;|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:")
$Submist_Drive = GUICtrlCreateButton("Change", 8, 32, 113, 25)
$Cancel = GUICtrlCreateButton("Cancel", 8, 64, 113, 25)
GUISetState(@SW_HIDE, $Select)

; Third GUI
$ThunderbirdUI = GUICreate("Select type", 327, 86, 192, 124, $WS_DLGFRAME)
$Portable = GUICtrlCreateButton("Portable", 0, 8, 97, 49)
GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
$Installed = GUICtrlCreateButton("Installed", 224, 8, 97, 49)
GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
$Cancel1 = GUICtrlCreateButton("Cancel", 112, 8, 97, 49)
GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
GUISetState(@SW_HIDE, $ThunderbirdUI)

#endregion ### END Koda GUI section ###


If _Singleton("I don't know what this does, but it works.", 1) = 0 Then
    GUISetState(@SW_HIDE, $maingui)
    GUIDelete($maingui)
    MsgBox(48, "Error", "The program is already open!")
    Exit
EndIf

If Not FileExists("Config.ini") Then
    GUISetState(@SW_DISABLE, $maingui)
    MsgBox(48, "Error", "Ini does not exist, a new one will be made with the defult values")
    GUISetState(@SW_DISABLE, $maingui)
    _iniWrite("D:")
    GUISetState(@SW_ENABLE, $maingui)
EndIf

_Check()

#region ### Ini Read start ### ini=

$IniFirefox = IniRead("Config.ini", "LocationNames", "$Firefox", "Not found")

$IniScite = IniRead("Config.ini", "LocationNames", "$Scite", "Not found")

$IniPaleMoon = IniRead("Config.ini", "LocationNames", "$PaleMoon", "Not found")

$IniSTS = IniRead("Config.ini", "LocationNames", "$STS", "Not found")

$IniNotepad = IniRead("Config.ini", "LocationNames", "$Notepad", "Not found")

$IniSkype = IniRead("Config.ini", "LocationNames", "$Skype", "Not found")

$Editprogramini = IniRead("Config.ini", "LocationNames", "$EditProgram", "Not found")

$Thunderbirdini = IniRead("Config.ini", "LocationNames", "$Thunderbirdini", "Not found")

$ThunderbirdInstall = IniRead("Config.ini", "LocationNames", "$ThunderbirdInstall", "Not found")

$Thunderbird64 = IniRead("Config.ini", "LocationNames", "$Thunderbird64", "Not found")

$Tomcat = IniRead("Config.ini", "LocationNames", "$Tomcat", "Not found")

$SQLyogini = IniRead("Config.ini", "LocationNames", "$SQLyog", "Not found")

#endregion ### Ini Read start ### ini=

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Firefox
            Run($IniFirefox)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Scite
            Run($IniScite)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $PaleMoon
            Run($IniPaleMoon)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $STS
            Run($IniSTS)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Notepad
            Run($IniNotepad)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Skype
            Run($IniSkype)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Exit
            GUISetState(@SW_DISABLE, $maingui)
            $quit = MsgBox(52, "Quit", "Are you sure you want to exit?")
            If $quit = 6 Then
                Exit
            Else
                GUISetState(@SW_ENABLE, $maingui)
            EndIf
        Case $Edit
            ShellExecute($Editprogramini)
        Case $Reset
            GUISetState(@SW_DISABLE, $maingui)
            If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
            $iMsgBoxAnswer = MsgBox(36, "Reset?", "Are you sure you want to reset the configuation? This will reset the config to defults; ALL CHANGES WILL BE LOST")
            Select
                Case $iMsgBoxAnswer = 6
                    $restedelete = FileDelete("config.ini")
                    If $restedelete = 0 Then
                        _iniWrite("D:")
                    Else
                        _iniWrite("D:")
                    EndIf
                    MsgBox(64, "Please restart", "Please restart the program")
                    Exit
                Case $iMsgBoxAnswer = 7
                    GUISetState(@SW_ENABLE, $maingui)
            EndSelect
        Case $Edit_Config
            $test = ShellExecute(@WorkingDir & "\Config.ini")
        Case $Drive_Letter
            GUISetState(@SW_SHOW, $Select)
            GUISetState(@SW_DISABLE, $maingui)
        Case $Submist_Drive
            GUISetState(@SW_DISABLE, $Select)
            $read_selection = GUICtrlRead($Drive_ID)
            If $read_selection = "Select Drive" Then
                MsgBox(48, "Warning", "Please select a drive letter")
                GUISetState(@SW_ENABLE, $Select)
            Else
                $Warning_box = MsgBox(52, "Warning", "Are you sure you want to change the Drive letter in the config file to: " & $read_selection)
                If $Warning_box = 6 Then
                    _iniWrite($read_selection)
                    GUIDelete($maingui)
                    GUIDelete($Select)
                    MsgBox(64, "Please restart", "Please restart the program")
                    Exit
                Else
                    GUISetState(@SW_ENABLE, $Select)
                EndIf
            EndIf
        Case $Cancel
            GUISetState(@SW_HIDE, $Select)
            GUISetState(@SW_ENABLE, $maingui)
        Case $Thunderbird
            GUISetState(@SW_SHOW, $ThunderbirdUI)
            GUISetState(@SW_DISABLE, $maingui)
        Case $Cancel1
            GUISetState(@SW_HIDE, $ThunderbirdUI)
            GUISetState(@SW_ENABLE, $maingui)
        Case $Portable
            Run($Thunderbirdini)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            Else
                GUISetState(@SW_HIDE, $ThunderbirdUI)
                GUISetState(@SW_ENABLE, $maingui)
            EndIf
        Case $Installed
            If @OSArch = "X64" Then
                Run($Thunderbird64)
                If @error Then
                    MsgBox(48, "Error", "There was a error while trying to open this program")
                Else
                    GUISetState(@SW_HIDE, $ThunderbirdUI)
                    GUISetState(@SW_ENABLE, $maingui)
                EndIf
            Else
                Run($ThunderbirdInstall)
                If @error Then
                    MsgBox(48, "Error", "There was a error while trying to open this program")
                Else
                    GUISetState(@SW_HIDE, $ThunderbirdUI)
                    GUISetState(@SW_ENABLE, $maingui)
                EndIf
            EndIf
        Case $Tomcatui
            Run($Tomcat)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $admin
            GUISetState(@SW_DISABLE, $maingui)
            _Crypt_Startup()
            While 1
                $key = InputBox("Enter key", "Please enter the key to Unlock the code", "Null")
                If @error = 1 Then
                    GUISetState(@SW_ENABLE, $maingui)
                    ExitLoop
                EndIf
                $crypt_Key = (StringTrimLeft(_Crypt_HashData($key, $CALG_SHA1), 2))
                If $crypt_Key == "55C388D3015FF7544A9D1FD8186A04FD88000209" Then ;Adminallowed1
                    GUISetState(@SW_HIDE, $maingui)
                    MsgBox(64, "Correct", "Correct key, features are now unlocked", 5)
                    MsgBox(64, "code on this computer", "This computer is registerd for the code, if you delete the code, you can't get it back... Unless you are clever.")
                    $downloadTest = InetGet("https://dl.dropboxusercontent.com/s/ybcjjrslgtjzlhe/QuickLaunch.au3?dl=1&token_hash=AAHNERKvJbqjw9dt59HX5wPVvnLbQL5pQo-smUbykEwKUg", "Quicklaunch.au3", 1, 0)
                    If $downloadTest = 0 Then ;error downloading
                        MsgBox(16, "error", "There was an Error downloading or genarating the code, please allow the program though the firewall, If this happens again, contact Author")
                        ExitLoop
                    EndIf
                    $errorCrypt = IniWrite(@TempDir & "/Admin.ini", "Isadmin", "$admin", StringTrimLeft(_Crypt_HashData("youareadmin", $CALG_SHA1), 2))
                    If $errorCrypt = 0 Then
                        MsgBox(16, "Error", "Could not save Admin settings, this is not a problem: continueing...")
                        ExitLoop
                    EndIf
                    MsgBox(64, "Please restart", "Please restart the program")
                    Exit
                Else
                    MsgBox(48, "Incorrect key", "Key is not correct!")
                EndIf
                _Crypt_Shutdown()
            WEnd
        Case $SQLyog
            Run($SQLyogini)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
    EndSwitch
WEnd

Func _Check()
    $isadmin = IniRead(@TempDir & "/Admin.ini", "Isadmin", "$admin", "apples")
    If $isadmin = "FA15EB666BCBA6755735B9767F3FE99D80121473" Then
        GUICtrlSetState($admin, $GUI_DISABLE)
        Local $i = IniWrite("Config.ini", "LocationNames", "$EditProgram", "Quicklaunch.au3")
        If $i = 0 Then
            MsgBox(16, "Error", "file is read-only!")
        EndIf
    EndIf
EndFunc   ;==>_Check

Func _iniWrite($reading)
    $error = IniWrite("Config.ini", "LocationNames", "$Firefox", "C:\Program Files\Cyberfox\Cyberfox.exe")

    IniWrite("Config.ini", "LocationNames", "$Scite", $reading & "\Portible\AutoIt3\SciTE\SciTE.exe")

    IniWrite("Config.ini", "LocationNames", "$PaleMoon", $reading & "\Portible\Firefox(x86-64bit)\pale moon\Palemoon-Portable.exe")

    IniWrite("Config.ini", "LocationNames", "$STS", $reading & "\Portible\springsource\sts-3.4.0.RELEASE\STS.exe")

    IniWrite("Config.ini", "LocationNames", "$Notepad", $reading & "\Portible\Notepad++\notepad++.exe")

    IniWrite("Config.ini", "LocationNames", "$Skype", $reading & "\Portible\Skype\SkypePortable.exe")

    IniWrite("Config.ini", "LocationNames", "$EditProgram", $reading & "\auto it programs\close\close.au3")

    IniWrite("Config.ini", "LocationNames", "$Thunderbirdini", $reading & "\Portible\ThunderbirdPortable\ThunderbirdPortable.exe")

    IniWrite("Config.ini", "LocationNames", "$ThunderbirdInstall", "C:\Program Files\Mozilla Thunderbird\Thunderbird.exe")

    IniWrite("Config.ini", "LocationNames", "$Thunderbird64", "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe")

    IniWrite("Config.ini", "LocationNames", "$Tomcat", "C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\Tomcat7.exe")

    IniWrite("Config.ini", "LocationNames", "$SQLyog", "C:\Program Files\SQLyog Community\SQLyogCommunity.exe")

    Sleep(1000)
    If $error = 0 Then
        GUIDelete($maingui)
        MsgBox(16, "Error", "Could not make Ini file, reason of this could be that the folder is read only")
        Exit
    Else
        MsgBox(64, "Done", "Ini made")
    EndIf

EndFunc   ;==>_iniWrite

Share this post


Link to post
Share on other sites



Victorique,

What do you mean by "multiple action listeners"? 

The posted code runs, the hotkeys operate, the target drive can be changed and the controls can be actioned with expected results.

What is the problem/question exactly?

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hello.

Sorry if this sounds stupid, but my switch statement is getting really big. The link explained how I can use multiple switch statement with GUIGetMsg listening to both GUI, so I can have my ui created on click, and then using GUIdestroy when I close them.

I basically want my GUIGetMsg for each of my ui, and for them to be created on click instead of just shown and then hidden .

This is the code demonstrated

$aMsg = GUIGetMsg(1) ; Use advanced parameter to get an array returned

Switch $aMsg[1] ; First check which GUI sent the message

Case $hGUI1

Switch $aMsg[0] ; Now check for the messages sent from $hGUI1

Case $GUI_EVENT_CLOSE

; Code

Case $hControl

; Code

EndSwitch

Case $hGUI2

Switch $aMsg[0] ; Now check for the messages sent from $hGUI2

Case $GUI_EVENT_CLOSE

; Code

Case $hButton3

; Code

EndSwitch

EndSwitch

(sorry I don't know the taga to syntax, and on my phone, the shortcuts don't show)

Sorry gain if this is stupid. :

I don't really understand this and was wondering if someone could give me an example of that regarding my program.

Edited by Victorique

Share this post


Link to post
Share on other sites

Hello Victorique,

GuiSwitch can do this for you. It tells AutoIt to use another Gui as the current Gui to receive the messages. The 2nd and 3rd Gui can just be put into user defined functions and have their own loops. The good idea about this is that you can make some of the variables local. No need for the GuiGetMsg advanced mode. So now you have _Gui_Select() and _Gui_Thunderbird() functions.

Changes I made

#NoTrayIcon
#RequireAdmin
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=C:\Users\Accelerator\Desktop\Quicklaunch.exe
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
;#include <_UskinLibrary.au3>
;#include <Skins/XXX.au3>
;#include <DesuSplash2.au3>
#include <Crypt.au3>
;#region ### Thweme load section (may select soon) ### Form=
;_Uskin_LoadDLL()
;_Uskin_Init(_XXX(True))
;#endregion ### Thweme load section (may select soon) ### Form=
 
;#region ### Splash screen ### start=
;SplashImageOn("Desu Splash", _DesuSplash2(True), 650, 303, -1, -1, 1)
;Sleep(5000)
;SplashOff()
#endregion ### Splash screen ### start=
 
$hParent = GUICreate("parent");not shown
GUISetState(@SW_DISABLE, $hParent)
GUISetState(@SW_HIDE, $hParent)
#region ### START Koda GUI section ### Form=
$maingui = GUICreate("Quick launch V1.5", 225, 315, 470, 34, $WS_DLGFRAME, -1, $hParent)
$Firefox = GUICtrlCreateButton("Cyberfox", 0, 0, 105, 49)
$File = GUICtrlCreateMenu("File")
$Edit = GUICtrlCreateMenuItem("Edit program", $File)
$Reset = GUICtrlCreateMenuItem("Reset Configuration file", $File)
$admin = GUICtrlCreateMenuItem("Enter Admin key", $File)
$Edi = GUICtrlCreateMenu("Edit")
$Edit_Config = GUICtrlCreateMenuItem("Edit Config file", $Edi)
$Drive_Letter = GUICtrlCreateMenuItem("Change Drive letter", $Edi)
$Scite = GUICtrlCreateButton("Scite", 120, 0, 105, 49)
$PaleMoon = GUICtrlCreateButton("Pale moon", 0, 56, 105, 49)
$STS = GUICtrlCreateButton("STS", 120, 56, 105, 49)
GUICtrlSetTip($STS, "Eclipse")
$Notepad = GUICtrlCreateButton("notepad++", 0, 112, 105, 49)
$Skype = GUICtrlCreateButton("Skype", 120, 112, 105, 49)
$Exit = GUICtrlCreateButton("Exit", 120, 224, 105, 49)
$Thunderbird = GUICtrlCreateButton("Thunderbird", 120, 168, 105, 49)
$Tomcatui = GUICtrlCreateButton("Tomcat", 0, 168, 105, 49)
$SQLyog = GUICtrlCreateButton("SQLyog", 0, 224, 105, 49)
Dim $maingui_AccelTable[7][2] = [["{F1}", $Firefox],["{F2}", $Scite],["{F3}", $PaleMoon],["{F4}", $STS],["{F5}", $Notepad],["{F6}", $Skype],["{F7}", $Tomcatui]]; 2 dimentinal array to create keyboard shortcuts using "F" keys
GUISetAccelerators($maingui_AccelTable)
GUISetState(@SW_SHOW)

#endregion ### END Koda GUI section ###
 
 
If _Singleton("I don't know what this does, but it works.", 1) = 0 Then
    GUISetState(@SW_HIDE, $maingui)
    GUIDelete($maingui)
    MsgBox(48, "Error", "The program is already open!")
    Exit
EndIf
 
If Not FileExists("Config.ini") Then
    GUISetState(@SW_DISABLE, $maingui)
    MsgBox(48, "Error", "Ini does not exist, a new one will be made with the defult values")
    GUISetState(@SW_DISABLE, $maingui)
    _iniWrite("D:")
    GUISetState(@SW_ENABLE, $maingui)
EndIf
 
_Check()
 
#region ### Ini Read start ### ini=
 
$IniFirefox = IniRead("Config.ini", "LocationNames", "$Firefox", "Not found")
 
$IniScite = IniRead("Config.ini", "LocationNames", "$Scite", "Not found")
 
$IniPaleMoon = IniRead("Config.ini", "LocationNames", "$PaleMoon", "Not found")
 
$IniSTS = IniRead("Config.ini", "LocationNames", "$STS", "Not found")
 
$IniNotepad = IniRead("Config.ini", "LocationNames", "$Notepad", "Not found")
 
$IniSkype = IniRead("Config.ini", "LocationNames", "$Skype", "Not found")
 
$Editprogramini = IniRead("Config.ini", "LocationNames", "$EditProgram", "Not found")
 
$Thunderbirdini = IniRead("Config.ini", "LocationNames", "$Thunderbirdini", "Not found")
 
$ThunderbirdInstall = IniRead("Config.ini", "LocationNames", "$ThunderbirdInstall", "Not found")
 
$Thunderbird64 = IniRead("Config.ini", "LocationNames", "$Thunderbird64", "Not found")
 
$Tomcat = IniRead("Config.ini", "LocationNames", "$Tomcat", "Not found")
 
$SQLyogini = IniRead("Config.ini", "LocationNames", "$SQLyog", "Not found")
 
#endregion ### Ini Read start ### ini=
 
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Exit
            GUISetState(@SW_DISABLE, $maingui)
            $quit = MsgBox(52, "Quit", "Are you sure you want to exit?")
            If $quit = 6 Then
                Exit
            Else
                GUISetState(@SW_ENABLE, $maingui)
            EndIf
        Case $Firefox
            Run($IniFirefox)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Scite
            Run($IniScite)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $PaleMoon
            Run($IniPaleMoon)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $STS
            Run($IniSTS)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Notepad
            Run($IniNotepad)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Skype
            Run($IniSkype)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Edit
            ShellExecute($Editprogramini)
        Case $Reset
            GUISetState(@SW_DISABLE, $maingui)
            If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
            $iMsgBoxAnswer = MsgBox(36, "Reset?", "Are you sure you want to reset the configuation? This will reset the config to defults; ALL CHANGES WILL BE LOST")
            Select
                Case $iMsgBoxAnswer = 6
                    $restedelete = FileDelete("config.ini")
                    If $restedelete = 0 Then
                        _iniWrite("D:")
                    Else
                        _iniWrite("D:")
                    EndIf
                    MsgBox(64, "Please restart", "Please restart the program")
                    Exit
                Case $iMsgBoxAnswer = 7
                    GUISetState(@SW_ENABLE, $maingui)
            EndSelect
        Case $Edit_Config
            $test = ShellExecute(@WorkingDir & "\Config.ini")
        Case $Drive_Letter
            GUISetState(@SW_DISABLE, $maingui)
            _Gui_Select()
            GUISetState(@SW_ENABLE, $maingui)
            WinActivate($maingui)
        Case $Thunderbird
            GUISetState(@SW_DISABLE, $maingui)
            _Gui_Thunderbird()
            GUISetState(@SW_ENABLE, $maingui)
            WinActivate($maingui)
        Case $Tomcatui
            Run($Tomcat)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $admin
            GUISetState(@SW_DISABLE, $maingui)
            _Crypt_Startup()
            While 1
                $key = InputBox("Enter key", "Please enter the key to Unlock the code", "Null")
                If @error = 1 Then
                    GUISetState(@SW_ENABLE, $maingui)
                    ExitLoop
                EndIf
                $crypt_Key = (StringTrimLeft(_Crypt_HashData($key, $CALG_SHA1), 2))
                If $crypt_Key == "55C388D3015FF7544A9D1FD8186A04FD88000209" Then ;Adminallowed1
                    GUISetState(@SW_HIDE, $maingui)
                    MsgBox(64, "Correct", "Correct key, features are now unlocked", 5)
                    MsgBox(64, "code on this computer", "This computer is registerd for the code, if you delete the code, you can't get it back... Unless you are clever.")
                    $downloadTest = InetGet("https://dl.dropboxusercontent.com/s/ybcjjrslgtjzlhe/QuickLaunch.au3?dl=1&token_hash=AAHNERKvJbqjw9dt59HX5wPVvnLbQL5pQo-smUbykEwKUg", "Quicklaunch.au3", 1, 0)
                    If $downloadTest = 0 Then ;error downloading
                        MsgBox(16, "error", "There was an Error downloading or genarating the code, please allow the program though the firewall, If this happens again, contact Author")
                        ExitLoop
                    EndIf
                    $errorCrypt = IniWrite(@TempDir & "/Admin.ini", "Isadmin", "$admin", StringTrimLeft(_Crypt_HashData("youareadmin", $CALG_SHA1), 2))
                    If $errorCrypt = 0 Then
                        MsgBox(16, "Error", "Could not save Admin settings, this is not a problem: continueing...")
                        ExitLoop
                    EndIf
                    MsgBox(64, "Please restart", "Please restart the program")
                    Exit
                Else
                    MsgBox(48, "Incorrect key", "Key is not correct!")
                EndIf
                _Crypt_Shutdown()
            WEnd
        Case $SQLyog
            Run($SQLyogini)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
    EndSwitch
WEnd

Func _Gui_Select()
    ; Second GUI
    Local $Cancel, $Drive_ID, $read_selection, $Select, $Submist_Drive, $Warning_box
    ; Global $maingui
    $Select = GUICreate("select Drive", 131, 120, 192, 124, $WS_DLGFRAME, $ES_READONLY)
    $Drive_ID = GUICtrlCreateCombo("Select Drive", 8, 8, 113, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "A:|B:|C:|D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:")
    $Submist_Drive = GUICtrlCreateButton("Change", 8, 32, 113, 25)
    $Cancel = GUICtrlCreateButton("Cancel", 8, 64, 113, 25)
    GUISetState()
    ;
    GUISwitch($Select); set this Gui as current to receive messages
    ;
    While 1
        Switch GUIGetMsg()
            Case $Submist_Drive
                GUISetState(@SW_DISABLE, $Select)
                $read_selection = GUICtrlRead($Drive_ID)
                If $read_selection = "Select Drive" Then
                    MsgBox(48, "Warning", "Please select a drive letter")
                    GUISetState(@SW_ENABLE, $Select)
                Else
                    $Warning_box = MsgBox(52, "Warning", "Are you sure you want to change the Drive letter in the config file to: " & $read_selection)
                    If $Warning_box = 6 Then
                        _iniWrite($read_selection)
                        GUIDelete($maingui) ; GLOBAL
                        GUIDelete($Select)
                        MsgBox(64, "Please restart", "Please restart the program")
                        Exit
                    Else
                        GUISetState(@SW_ENABLE, $Select)
                    EndIf
                EndIf
            Case $Cancel, $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    ;
    GUIDelete($Select)
EndFunc

Func _Gui_Thunderbird()
    ; Third GUI
    Local $Cancel, $Installed, $Portable, $ThunderbirdUI
    ;Global $Thunderbird64, $Thunderbirdini, $ThunderbirdInstall
    $ThunderbirdUI = GUICreate("Select type", 327, 86, 192, 124, $WS_DLGFRAME)
    $Portable = GUICtrlCreateButton("Portable", 0, 8, 97, 49)
    GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
    $Installed = GUICtrlCreateButton("Installed", 224, 8, 97, 49)
    GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
    $Cancel = GUICtrlCreateButton("Cancel", 112, 8, 97, 49)
    GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
    GUISetState()
    ;
    GUISwitch($ThunderbirdUI); set this Gui as current to receive messages
    ;
    While 1
        Switch GUIGetMsg()
            Case $Portable
                Run($Thunderbirdini)
                If @error Then
                    MsgBox(48, "Error", "There was a error while trying to open this program")
                EndIf
            Case $Installed
                If @OSArch = "X64" Then
                    Run($Thunderbird64)
                    If @error Then
                        MsgBox(48, "Error", "There was a error while trying to open this program")
                    EndIf
                Else
                    Run($ThunderbirdInstall)
                    If @error Then
                        MsgBox(48, "Error", "There was a error while trying to open this program")
                    EndIf
                EndIf
            Case $Cancel, $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    ;
    GUIDelete($ThunderbirdUI)
EndFunc

Func _Check()
    $isadmin = IniRead(@TempDir & "/Admin.ini", "Isadmin", "$admin", "apples")
    If $isadmin = "FA15EB666BCBA6755735B9767F3FE99D80121473" Then
        GUICtrlSetState($admin, $GUI_DISABLE)
        Local $i = IniWrite("Config.ini", "LocationNames", "$EditProgram", "Quicklaunch.au3")
        If $i = 0 Then
            MsgBox(16, "Error", "file is read-only!")
        EndIf
    EndIf
EndFunc   ;==>_Check
 
Func _iniWrite($reading)
    $error = IniWrite("Config.ini", "LocationNames", "$Firefox", "C:\Program Files\Cyberfox\Cyberfox.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Scite", $reading & "\Portible\AutoIt3\SciTE\SciTE.exe")
 
    IniWrite("Config.ini", "LocationNames", "$PaleMoon", $reading & "\Portible\Firefox(x86-64bit)\pale moon\Palemoon-Portable.exe")
 
    IniWrite("Config.ini", "LocationNames", "$STS", $reading & "\Portible\springsource\sts-3.4.0.RELEASE\STS.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Notepad", $reading & "\Portible\Notepad++\notepad++.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Skype", $reading & "\Portible\Skype\SkypePortable.exe")
 
    IniWrite("Config.ini", "LocationNames", "$EditProgram", $reading & "\auto it programs\close\close.au3")
 
    IniWrite("Config.ini", "LocationNames", "$Thunderbirdini", $reading & "\Portible\ThunderbirdPortable\ThunderbirdPortable.exe")
 
    IniWrite("Config.ini", "LocationNames", "$ThunderbirdInstall", "C:\Program Files\Mozilla Thunderbird\Thunderbird.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Thunderbird64", "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Tomcat", "C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\Tomcat7.exe")
 
    IniWrite("Config.ini", "LocationNames", "$SQLyog", "C:\Program Files\SQLyog Community\SQLyogCommunity.exe")
 
    Sleep(1000)
    If $error = 0 Then
        GUIDelete($maingui)
        MsgBox(16, "Error", "Could not make Ini file, reason of this could be that the folder is read only")
        Exit
    Else
        MsgBox(64, "Done", "Ini made")
    EndIf
 
EndFunc   ;==>_iniWrite

Just check to make sure that I have not broken something. :)

1 person likes this

Share this post


Link to post
Share on other sites

Hello Victorique,

GuiSwitch can do this for you. It tells AutoIt to use another Gui as the current Gui to receive the messages. The 2nd and 3rd Gui can just be put into user defined functions and have their own loops. The good idea about this is that you can make some of the variables local. No need for the GuiGetMsg advanced mode. So now you have _Gui_Select() and _Gui_Thunderbird() functions.

Changes I made

#NoTrayIcon
#RequireAdmin
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=C:\Users\Accelerator\Desktop\Quicklaunch.exe
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
;#include <_UskinLibrary.au3>
;#include <Skins/XXX.au3>
;#include <DesuSplash2.au3>
#include <Crypt.au3>
;#region ### Thweme load section (may select soon) ### Form=
;_Uskin_LoadDLL()
;_Uskin_Init(_XXX(True))
;#endregion ### Thweme load section (may select soon) ### Form=
 
;#region ### Splash screen ### start=
;SplashImageOn("Desu Splash", _DesuSplash2(True), 650, 303, -1, -1, 1)
;Sleep(5000)
;SplashOff()
#endregion ### Splash screen ### start=
 
$hParent = GUICreate("parent");not shown
GUISetState(@SW_DISABLE, $hParent)
GUISetState(@SW_HIDE, $hParent)
#region ### START Koda GUI section ### Form=
$maingui = GUICreate("Quick launch V1.5", 225, 315, 470, 34, $WS_DLGFRAME, -1, $hParent)
$Firefox = GUICtrlCreateButton("Cyberfox", 0, 0, 105, 49)
$File = GUICtrlCreateMenu("File")
$Edit = GUICtrlCreateMenuItem("Edit program", $File)
$Reset = GUICtrlCreateMenuItem("Reset Configuration file", $File)
$admin = GUICtrlCreateMenuItem("Enter Admin key", $File)
$Edi = GUICtrlCreateMenu("Edit")
$Edit_Config = GUICtrlCreateMenuItem("Edit Config file", $Edi)
$Drive_Letter = GUICtrlCreateMenuItem("Change Drive letter", $Edi)
$Scite = GUICtrlCreateButton("Scite", 120, 0, 105, 49)
$PaleMoon = GUICtrlCreateButton("Pale moon", 0, 56, 105, 49)
$STS = GUICtrlCreateButton("STS", 120, 56, 105, 49)
GUICtrlSetTip($STS, "Eclipse")
$Notepad = GUICtrlCreateButton("notepad++", 0, 112, 105, 49)
$Skype = GUICtrlCreateButton("Skype", 120, 112, 105, 49)
$Exit = GUICtrlCreateButton("Exit", 120, 224, 105, 49)
$Thunderbird = GUICtrlCreateButton("Thunderbird", 120, 168, 105, 49)
$Tomcatui = GUICtrlCreateButton("Tomcat", 0, 168, 105, 49)
$SQLyog = GUICtrlCreateButton("SQLyog", 0, 224, 105, 49)
Dim $maingui_AccelTable[7][2] = [["{F1}", $Firefox],["{F2}", $Scite],["{F3}", $PaleMoon],["{F4}", $STS],["{F5}", $Notepad],["{F6}", $Skype],["{F7}", $Tomcatui]]; 2 dimentinal array to create keyboard shortcuts using "F" keys
GUISetAccelerators($maingui_AccelTable)
GUISetState(@SW_SHOW)

#endregion ### END Koda GUI section ###
 
 
If _Singleton("I don't know what this does, but it works.", 1) = 0 Then
    GUISetState(@SW_HIDE, $maingui)
    GUIDelete($maingui)
    MsgBox(48, "Error", "The program is already open!")
    Exit
EndIf
 
If Not FileExists("Config.ini") Then
    GUISetState(@SW_DISABLE, $maingui)
    MsgBox(48, "Error", "Ini does not exist, a new one will be made with the defult values")
    GUISetState(@SW_DISABLE, $maingui)
    _iniWrite("D:")
    GUISetState(@SW_ENABLE, $maingui)
EndIf
 
_Check()
 
#region ### Ini Read start ### ini=
 
$IniFirefox = IniRead("Config.ini", "LocationNames", "$Firefox", "Not found")
 
$IniScite = IniRead("Config.ini", "LocationNames", "$Scite", "Not found")
 
$IniPaleMoon = IniRead("Config.ini", "LocationNames", "$PaleMoon", "Not found")
 
$IniSTS = IniRead("Config.ini", "LocationNames", "$STS", "Not found")
 
$IniNotepad = IniRead("Config.ini", "LocationNames", "$Notepad", "Not found")
 
$IniSkype = IniRead("Config.ini", "LocationNames", "$Skype", "Not found")
 
$Editprogramini = IniRead("Config.ini", "LocationNames", "$EditProgram", "Not found")
 
$Thunderbirdini = IniRead("Config.ini", "LocationNames", "$Thunderbirdini", "Not found")
 
$ThunderbirdInstall = IniRead("Config.ini", "LocationNames", "$ThunderbirdInstall", "Not found")
 
$Thunderbird64 = IniRead("Config.ini", "LocationNames", "$Thunderbird64", "Not found")
 
$Tomcat = IniRead("Config.ini", "LocationNames", "$Tomcat", "Not found")
 
$SQLyogini = IniRead("Config.ini", "LocationNames", "$SQLyog", "Not found")
 
#endregion ### Ini Read start ### ini=
 
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Exit
            GUISetState(@SW_DISABLE, $maingui)
            $quit = MsgBox(52, "Quit", "Are you sure you want to exit?")
            If $quit = 6 Then
                Exit
            Else
                GUISetState(@SW_ENABLE, $maingui)
            EndIf
        Case $Firefox
            Run($IniFirefox)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Scite
            Run($IniScite)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $PaleMoon
            Run($IniPaleMoon)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $STS
            Run($IniSTS)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Notepad
            Run($IniNotepad)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Skype
            Run($IniSkype)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $Edit
            ShellExecute($Editprogramini)
        Case $Reset
            GUISetState(@SW_DISABLE, $maingui)
            If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
            $iMsgBoxAnswer = MsgBox(36, "Reset?", "Are you sure you want to reset the configuation? This will reset the config to defults; ALL CHANGES WILL BE LOST")
            Select
                Case $iMsgBoxAnswer = 6
                    $restedelete = FileDelete("config.ini")
                    If $restedelete = 0 Then
                        _iniWrite("D:")
                    Else
                        _iniWrite("D:")
                    EndIf
                    MsgBox(64, "Please restart", "Please restart the program")
                    Exit
                Case $iMsgBoxAnswer = 7
                    GUISetState(@SW_ENABLE, $maingui)
            EndSelect
        Case $Edit_Config
            $test = ShellExecute(@WorkingDir & "\Config.ini")
        Case $Drive_Letter
            GUISetState(@SW_DISABLE, $maingui)
            _Gui_Select()
            GUISetState(@SW_ENABLE, $maingui)
            WinActivate($maingui)
        Case $Thunderbird
            GUISetState(@SW_DISABLE, $maingui)
            _Gui_Thunderbird()
            GUISetState(@SW_ENABLE, $maingui)
            WinActivate($maingui)
        Case $Tomcatui
            Run($Tomcat)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
        Case $admin
            GUISetState(@SW_DISABLE, $maingui)
            _Crypt_Startup()
            While 1
                $key = InputBox("Enter key", "Please enter the key to Unlock the code", "Null")
                If @error = 1 Then
                    GUISetState(@SW_ENABLE, $maingui)
                    ExitLoop
                EndIf
                $crypt_Key = (StringTrimLeft(_Crypt_HashData($key, $CALG_SHA1), 2))
                If $crypt_Key == "55C388D3015FF7544A9D1FD8186A04FD88000209" Then ;Adminallowed1
                    GUISetState(@SW_HIDE, $maingui)
                    MsgBox(64, "Correct", "Correct key, features are now unlocked", 5)
                    MsgBox(64, "code on this computer", "This computer is registerd for the code, if you delete the code, you can't get it back... Unless you are clever.")
                    $downloadTest = InetGet("https://dl.dropboxusercontent.com/s/ybcjjrslgtjzlhe/QuickLaunch.au3?dl=1&token_hash=AAHNERKvJbqjw9dt59HX5wPVvnLbQL5pQo-smUbykEwKUg", "Quicklaunch.au3", 1, 0)
                    If $downloadTest = 0 Then ;error downloading
                        MsgBox(16, "error", "There was an Error downloading or genarating the code, please allow the program though the firewall, If this happens again, contact Author")
                        ExitLoop
                    EndIf
                    $errorCrypt = IniWrite(@TempDir & "/Admin.ini", "Isadmin", "$admin", StringTrimLeft(_Crypt_HashData("youareadmin", $CALG_SHA1), 2))
                    If $errorCrypt = 0 Then
                        MsgBox(16, "Error", "Could not save Admin settings, this is not a problem: continueing...")
                        ExitLoop
                    EndIf
                    MsgBox(64, "Please restart", "Please restart the program")
                    Exit
                Else
                    MsgBox(48, "Incorrect key", "Key is not correct!")
                EndIf
                _Crypt_Shutdown()
            WEnd
        Case $SQLyog
            Run($SQLyogini)
            If @error Then
                MsgBox(48, "Error", "There was a error while trying to open this program")
            EndIf
    EndSwitch
WEnd

Func _Gui_Select()
    ; Second GUI
    Local $Cancel, $Drive_ID, $read_selection, $Select, $Submist_Drive, $Warning_box
    ; Global $maingui
    $Select = GUICreate("select Drive", 131, 120, 192, 124, $WS_DLGFRAME, $ES_READONLY)
    $Drive_ID = GUICtrlCreateCombo("Select Drive", 8, 8, 113, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "A:|B:|C:|D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:")
    $Submist_Drive = GUICtrlCreateButton("Change", 8, 32, 113, 25)
    $Cancel = GUICtrlCreateButton("Cancel", 8, 64, 113, 25)
    GUISetState()
    ;
    GUISwitch($Select); set this Gui as current to receive messages
    ;
    While 1
        Switch GUIGetMsg()
            Case $Submist_Drive
                GUISetState(@SW_DISABLE, $Select)
                $read_selection = GUICtrlRead($Drive_ID)
                If $read_selection = "Select Drive" Then
                    MsgBox(48, "Warning", "Please select a drive letter")
                    GUISetState(@SW_ENABLE, $Select)
                Else
                    $Warning_box = MsgBox(52, "Warning", "Are you sure you want to change the Drive letter in the config file to: " & $read_selection)
                    If $Warning_box = 6 Then
                        _iniWrite($read_selection)
                        GUIDelete($maingui) ; GLOBAL
                        GUIDelete($Select)
                        MsgBox(64, "Please restart", "Please restart the program")
                        Exit
                    Else
                        GUISetState(@SW_ENABLE, $Select)
                    EndIf
                EndIf
            Case $Cancel, $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    ;
    GUIDelete($Select)
EndFunc

Func _Gui_Thunderbird()
    ; Third GUI
    Local $Cancel, $Installed, $Portable, $ThunderbirdUI
    ;Global $Thunderbird64, $Thunderbirdini, $ThunderbirdInstall
    $ThunderbirdUI = GUICreate("Select type", 327, 86, 192, 124, $WS_DLGFRAME)
    $Portable = GUICtrlCreateButton("Portable", 0, 8, 97, 49)
    GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
    $Installed = GUICtrlCreateButton("Installed", 224, 8, 97, 49)
    GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
    $Cancel = GUICtrlCreateButton("Cancel", 112, 8, 97, 49)
    GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
    GUISetState()
    ;
    GUISwitch($ThunderbirdUI); set this Gui as current to receive messages
    ;
    While 1
        Switch GUIGetMsg()
            Case $Portable
                Run($Thunderbirdini)
                If @error Then
                    MsgBox(48, "Error", "There was a error while trying to open this program")
                EndIf
            Case $Installed
                If @OSArch = "X64" Then
                    Run($Thunderbird64)
                    If @error Then
                        MsgBox(48, "Error", "There was a error while trying to open this program")
                    EndIf
                Else
                    Run($ThunderbirdInstall)
                    If @error Then
                        MsgBox(48, "Error", "There was a error while trying to open this program")
                    EndIf
                EndIf
            Case $Cancel, $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    ;
    GUIDelete($ThunderbirdUI)
EndFunc

Func _Check()
    $isadmin = IniRead(@TempDir & "/Admin.ini", "Isadmin", "$admin", "apples")
    If $isadmin = "FA15EB666BCBA6755735B9767F3FE99D80121473" Then
        GUICtrlSetState($admin, $GUI_DISABLE)
        Local $i = IniWrite("Config.ini", "LocationNames", "$EditProgram", "Quicklaunch.au3")
        If $i = 0 Then
            MsgBox(16, "Error", "file is read-only!")
        EndIf
    EndIf
EndFunc   ;==>_Check
 
Func _iniWrite($reading)
    $error = IniWrite("Config.ini", "LocationNames", "$Firefox", "C:\Program Files\Cyberfox\Cyberfox.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Scite", $reading & "\Portible\AutoIt3\SciTE\SciTE.exe")
 
    IniWrite("Config.ini", "LocationNames", "$PaleMoon", $reading & "\Portible\Firefox(x86-64bit)\pale moon\Palemoon-Portable.exe")
 
    IniWrite("Config.ini", "LocationNames", "$STS", $reading & "\Portible\springsource\sts-3.4.0.RELEASE\STS.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Notepad", $reading & "\Portible\Notepad++\notepad++.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Skype", $reading & "\Portible\Skype\SkypePortable.exe")
 
    IniWrite("Config.ini", "LocationNames", "$EditProgram", $reading & "\auto it programs\close\close.au3")
 
    IniWrite("Config.ini", "LocationNames", "$Thunderbirdini", $reading & "\Portible\ThunderbirdPortable\ThunderbirdPortable.exe")
 
    IniWrite("Config.ini", "LocationNames", "$ThunderbirdInstall", "C:\Program Files\Mozilla Thunderbird\Thunderbird.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Thunderbird64", "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe")
 
    IniWrite("Config.ini", "LocationNames", "$Tomcat", "C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\Tomcat7.exe")
 
    IniWrite("Config.ini", "LocationNames", "$SQLyog", "C:\Program Files\SQLyog Community\SQLyogCommunity.exe")
 
    Sleep(1000)
    If $error = 0 Then
        GUIDelete($maingui)
        MsgBox(16, "Error", "Could not make Ini file, reason of this could be that the folder is read only")
        Exit
    Else
        MsgBox(64, "Done", "Ini made")
    EndIf
 
EndFunc   ;==>_iniWrite

Just check to make sure that I have not broken something. :)

this is... Amazing... It is such a good example for me too, I used Autoit for so long, but always did Multiple UI with hide and show because clicking the "x" would close it all, but using the GUISwitch is so good (I knew it, but didn't understand how it works) and now you explain it, it makes sense.thank you so much!!! ♥


Share this post


Link to post
Share on other sites

Your welcome. The changes were not much at all as you had much of the code already. Things may seem complicated the 1st time though once you learn then it becomes easier and then you progress to the next challenge. Soon enough, you may be teaching me something. :)

Share this post


Link to post
Share on other sites

Your welcome. The changes were not much at all as you had much of the code already. Things may seem complicated the 1st time though once you learn then it becomes easier and then you progress to the next challenge. Soon enough, you may be teaching me something. :)

 

hehe, i wish i could be able to teach you something(or any MVP), but you're too good :)

I just started Secondary School  (High school) and I love Java and Autoit, and i hope that I will one day get a job in Programming. but Autoit is so much fun!

thank you again, MHz :)


Share this post


Link to post
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
Sign in to follow this  
Followers 0