Jump to content
Sign in to follow this  
Wingens

if i run this little piece of code my program closes/crashes

Recommended Posts

Wingens

Hi,

i am very new to this forum and to autoit, i have been struggeling for about to weeks now.

if i run my program and i check the one checkbox there is, then it wil run the setup but when the setup is finished my program closes/crashes, how come?

i think my program crashes because the network share i create when the button install is clicked does not disconnect after the setup.

This is the code i have:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=H:\AutoIT\Game Installer1.kxf

$Form2 = GUICreate("Game Installer BETA", 661, 571, -1, -1)

$Close = GUICtrlCreateButton("Close", 568, 528, 75, 25, 0)

$Install = GUICtrlCreateButton("Install", 480, 528, 75, 25, 0)

$COD2 = GUICtrlCreateCheckbox("Call of Duty 2", 104, 128, 145, 25)

GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$msg = GUIGetMsg()

Switch $msg

Case $Install

uitvoeren()

Case $GUI_EVENT_CLOSE, $Close

DriveMapDel("Z:")

ExitLoop

EndSwitch

Wend

Func uitvoeren()

DriveMapAdd("Z:" , "\\192.168.1.2\Share" , 0 , "Mark" , "getin")

Sleep(5000)

If $COD2 = $GUI_CHECKED Then RunWait ("Z:\COD2\setup.exe") EndIf

; RunWait ("Z:\COD2\setup.exe")

EndFunc

Share this post


Link to post
Share on other sites
YellowLab

Several things appear to be wrong:

1) Space between RunWait and the "("

2) Don't need the EndIf on a one line If statement

3) I don't think the variable $COD2 will ever equal $GUI_CHECKED. I think you want to check GUICtrlRead($COD2)=$GUI_CHECKED

Hope this helps,

Bob


You can't see a rainbow without first experiencing the rain.

Share this post


Link to post
Share on other sites
Wingens

oh thank you so much, now it works :D

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  

×