Jump to content

Problem comparing global variable


Recommended Posts

Hi there,

following problem:

global $test=""

func testfunc()
 $test=true
endfunc

func anotherfunc()
 if $test=true then
  do stuff
 endif
endfunc

so if my script is trying to compare the $test variable the script just quits without any error. I don't know what im doing wrong.

Basically thats what im trying to do the above testcode is working but my realscript isn't I would post the code of the real script

but as I have no idea which part is going wrong I didn't wanted to post the whole thing.

Any suggestions or help?

Regards Tekkion

Edited by Tekkion
Link to comment
Share on other sites

global $user_created=""
global $folder_created=""
global $rights_set=""
global $share_set=""
Local $colUsers, $sTmp="||", $Array[1] = ["user"]
$colUsers = ObjGet("WinNT://" & @ComputerName)
If IsObj($colUsers) Then
    $colUsers.Filter = $Array
    For $objUser In $colUsers
        $sTmp &= $objUser.Name &"|"
    Next
 EndIf
GUIDelete($wait)
MainWindow()
func MainWindow()
    Dim $avarray
    Local $hGUI = GUICreate("DKS Freigabe einrichten",300,300)
............................................................................................
                                        if DirGetSize(GUICtrlRead($DKI_Share_folder)) = -1 Then
                        if DirCreate(GUICtrlRead($DKI_Share_folder))=0 Then
                            $folder_created=False
                        Else
                            $folder_created=True
                        EndIf
                    endif
....................................................................................................
                    EndIf
                endif
            ;Caseend
        EndSwitch
    WEnd
    GUIDelete()
EndFunc   ;Mainwindow()

func status_windwo()
...........................................declarations..................................................
while 1
        if $folder_created=true Then
            if FileExists(@TempDir&"\user.txt") Then
                GUICtrlSetImage($led1,"green.jpg")
                $led1set=true
            Else
                GUICtrlSetImage($led1,"red.jpg")
                $led1set=true
            EndIf
        EndIf
        $msg = GUIGetMsg()
        switch  $msg
            case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    wend
EndFunc

as i said if im trying to compare the variable with a value the script just quits without it runs as expected.

Edited by Tekkion
Link to comment
Share on other sites

after my bath it seems my brain is working again...

I've put the function call above the variable declarations....

anyway Its somekind of weird that the script just quits with no error message...

thanks anyway

regards Tekkion

Edited by Tekkion
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...