Sign in to follow this  
Followers 0
huldu

Why is my script crashing? (GUICtrlSetData ?)

14 posts in this topic

#1 ·  Posted (edited)

Hey again!

My script is crashing, and you haveto force kill the program. Ive found the "bad" parts but like always i cant figure out why its crashing.

GUICtrlSetData($mylist, "") ; These 2 lines works great, until i run the MsgBox

GUICtrlSetData($mylist, $OpenFile) ; At that point the entire script crash and, program haveto be killed

MsgBox(64, "Success", "Path has been saved: " & @CRLF & $OpenFile) ;If i dont use this, everything works great.

This time ive added the script itself :P

-- The part above can be found at far bottom of the script.

-- I might add the chance of a crash is pretty high if ANY MsgBox is opened :lmao:

-- Doesnt even seem to be the above code that is causing this problem. If a MsgBox is open for more then a few seconds the entire script crash. Im trying to figure out what is causing this.

WTF.au3

Edited by huldu

"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites



Hey again!

My script is crashing, and you haveto force kill the program. Ive found the "bad" parts but like always i cant figure out why its crashing.

This time ive added the script itself :P

-- The part above can be found at far bottom of the script.

-- I might add the chance of a crash is pretty high if ANY MsgBox is opened :lmao:

-- Doesnt even seem to be the above code that is causing this problem. If a MsgBox is open for more then a few seconds the entire script crash. Im trying to figure out what is causing this.

It didn't crash on me, but all I was doing was selecting a file on my PC, left the message box up for a while with no problem

Share this post


Link to post
Share on other sites

You know where you run the game, don't you need to put the DIR from which the game runs?

Run($RunGame)

You need to get the path so that the application runs from the correct Directory otherwise it will run as if local to your script

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You know where you run the game, don't you need to put the DIR from which the game runs?

Run($RunGame)

You need to get the path so that the application runs from the correct Directory otherwise it will run as if local to your script

I get the directory from the .ini file. Either it has a default path to the dir and executable (ie c:\game\game.exe) or the user have changed it to where the game is found on his computer.

Func RunGame()
        If WinExists("SRO_client") == 1 Then
            MsgBox(16, "ERROR!", "Silkroad is already running.")
            $CheckProcess = 1
        Else
            $CheckProcess1 = 0
        EndIf
        If WinExists("Silkroad Online Launcher") == 1 Then
            MsgBox(16, "ERROR!", "Silkroad is already running.")
            $CheckProcess = 1
        Else
            $CheckProcess2 = 0
        EndIf
            
        If $CheckProcess1 == 0 Then
            If $CheckProcess2 == 0 Then
                
                $VerifyDir = IniRead(@ScriptDir & $FileName, "GAME", "Dir", "")
                
                If StringInStr($VerifyDir, "silkroad.exe") Then
                    If FileExists($VerifyDir) == 1 Then
                        $RunGame = $VerifyDir
                        Run($RunGame)
                    Else
                        MsgBox(16, "ERROR!", "Path to silkroad.exe is invalid!")
                    EndIf
                Else
                    MsgBox(16, "ERROR!", "Path to silkroad.exe is invalid, please verify location!")
                EndIf
            Else
            EndIf
        Else
        EndIf
    EndFunc

It should work fine, ive added another check just in case the .ini has a corrupted or wrong .exe selected (and user havent changed it)

The problem however is that i still get a crash somewhere in the script when OpenFileDialog is being run, very weird.. i just cant locate where the problem is. But im working on it.

Edited by huldu

"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites

I get the directory from the .ini file. Either it has a default path to the dir and executable (ie c:\game\game.exe) or the user have changed it to where the game is found on his computer.

Yeah I see that but in the help file it says.. Run ( "filename" [, "workingdir" [, flag]] )

When I have used run() and not specified a working dir the program I am running may not behave correctly because some files or resources it needs will try to load from the script dir if a working dir is not specified, you could get this from your ini file too by striping the string from the last occurence of \

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Yeah I see that but in the help file it says.. Run ( "filename" [, "workingdir" [, flag]] )

When I have used run() and not specified a working dir the program I am running may not behave correctly because some files or resources it needs will try to load from the script dir if a working dir is not specified, you could get this from your ini file too by striping the string from the last occurence of \

Run ( "filename" [, "workingdir" [, flag]] ) the "workingdir" optional? unless already specificed in the "filename" by a full path. I havent had a problem with this yet tho.

-- Ive just started thinking of removing all the MsgBox's it would work as a bandair perhaps, but wouldnt fix the problem itself. I could run all the info (that used to be in MsgBox) in my newly added Status field. But im not sure that will solve the problem at this time. Im still working on changing all the MsgBox'es as of now.

healthcheck10.au3

Edited by huldu

"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites

you have If StringInStr($VerifyDir, "silkroad.exe") Then

which should be If StringInStr($VerifyDir, "silkroad.exe") <> 0 Then


Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

you have If StringInStr($VerifyDir, "silkroad.exe") Then

which should be If StringInStr($VerifyDir, "silkroad.exe") <> 0 Then

Thanks ive changed that now :P , it worked without the <> 0, what does the <> 0 do?


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

basically, if string in string found, variable becomes position in string, otherwise zero

so if its not zero then it must exist in the string, it just keeps it tidy

i'll look at the rest of your script once i'm awake (late nite zzzzzzzzz)

Edited by Rick

Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

Run ( "filename" [, "workingdir" [, flag]] ) the "workingdir" optional? unless already specificed in the "filename" by a full path. I havent had a problem with this yet tho.

-- Ive just started thinking of removing all the MsgBox's it would work as a bandair perhaps, but wouldnt fix the problem itself. I could run all the info (that used to be in MsgBox) in my newly added Status field. But im not sure that will solve the problem at this time. Im still working on changing all the MsgBox'es as of now.

Ahh OK I see what you mean.

If you want to specify the Working Dir (not that you probably need to :P )

$RunGame = $VerifyDir

$TrimCount = StringInStr ( $RunGame, "\" , 0 , -1 )

$WorkingDir = StringTrimRight ($RunGame, (StringLen ( $RunGame ) - $TrimCount))

;;;;MsgBox (0,"",$WorkingDir)

Run($RunGame, $WorkingDir)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Grrr... this is tough. I might add that the crash doesnt happen during the OpenFileDialog, it happens somewhere after it. The funny thing is sometimes you can select the wrong .exe and no crash occurs, but sometimes it crash even here but not often. The crash rate if you select the correct .exe is probably 100% :lmao:

Ive changed a few things, because i thought the MsgBox'es were causing the problem.. new script if anyone is interested :P

-- Edit

Just added a ton of MsgBox'es in the script so i knew where it was in the code. I found out that the crash happens at the very end of SaveFileInfo() function. The script never returns to loop after reaching the end of SaveFileInfo() function.

healthcheck10.au3

Edited by huldu

"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites

Is it possible to change topic on a thread once its been posted or is it too late? (afterall my problem isnt GUICtrlSetData as i thought from the beginning)


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites

If you have found the specific problem, I would suggest maybe just starting a new topic on it if you don't know how to fix it... and noting in this one that you've done so.

This would help others that may be doing a search on a specific issue they are having easily find it.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Is it possible to change topic on a thread once its been posted or is it too late? (afterall my problem isnt GUICtrlSetData as i thought from the beginning)

just post what you want to change I will do it :P

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