Sign in to follow this  
Followers 0
Tekkion

Problem comparing global variable

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



did you use a random word generator to come up with this text?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If you want a serious response, then post some code that people can actually run. Make sure the code demonstrates the problem you are experiencing and give clear comments on how the functionality differs from the behaviour you expect.

Edited by czardas

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites
global $test=""
testfunc()
anotherfunc()
func testfunc()
 $test=true
endfunc

func anotherfunc()
 if $test=true then
 MsgBox(0,"","WORKS!")
 endif
endfunc

This will do it.REB

 

yeah I see i forget to call the funcs but not in my other script sorry for that
 

did you use a random word generator to come up with this text?

 

no

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

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