Jump to content

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


Recommended Posts

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

Link to comment
Share on other sites

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.

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...