bpmb wrote:
Somehow when I run this and the ini file is already there it still shows me the Gui created after ELSE?
If the code you are showing us is a subroutine that is part of a larger script then you are not destroying the GUI before you show it again,
i.e. the second part of the GUI adds those elements and then when it comes back around to GUI, SHOW in the first part it simply displays what has been built.
IF that is the case (pardon the pun) then do this: (maybe)
Code:
If (FileExist("%A_AppData%\Folder\config.ini") = A_AppData . "\Folder\config.ini"){
IniRead, BrowseSource, %A_AppData%\Folder\config.ini, Sourcefolder, key
IniRead, BrowseDest, %A_AppData%\Folder\config.ini, Destinationfolder, key
MsgBox %BrowseSource%`t%BrowseDest%
Gui, Destroy
Gui, Add, Text,, Do you want to backup your default folders?
Gui, Add, Button, , Yes
Gui, Add, Button, , No
Gui, Show
} else {
If (FileExist(A_AppData "\Folder\config.ini")!="D"){
FileCreateDir, %A_AppData%\Folder
FileAppend, , %A_AppData%\Folder\config.ini
}
Gui, Destroy
Gui, Add, Text,, Select the source folder:
Gui, Add, Edit, r1 w300 vSourceEdit,
Gui, Add, Button, gSource, Select
Gui, Add, Text,, Select the destination folder:
Gui, Add, Edit, r1 w300 vDestEdit,
Gui, Add, Button, gDest, Select
Gui, Add, Button, x+160, OK
Gui, Show, w320 h200
}
Return
You also should just be using msgbox...
replace this
Code:
Gui, Destroy
Gui, Add, Text,, Do you want to backup your default folders?
Gui, Add, Button, , Yes
Gui, Add, Button, , No
Gui, Show
with this
Code:
msgbox, 1,, Do you want to backup your default folders?
you can then use
Code:
IfMsgBox Yes
{
msgbox you pressed yes!
}
ELSE
{
msgbox you pressed no!
}
Etc