Sign in to follow this  
Followers 0
sc4ry

TrayMenu during Script

1 post in this topic

Hey,

i have the following code. there are 2 big parts, the _INIExist() and the _OldIniExist - Function.

short description:

_INIExist ist the "Main"-part, it is always called, when the ini including the settings is found.

_OldIniExist is the part, if no ini was found (or an ini of an older version of this script). after that you see a gui were you can do, or change, your settings.

in both function is a part (the last part), where the script, if the user do the settings, waits, until the pc-shutdown close the script.

when this part is arrived, i want to be able, to edit my settings at every time using the traymenu. so it should show the gui again.

in the _OldIniExist-part i included this function in the tray, and now it works (perfect), because now it is only show/hide the gui again. but in the _IniExist-part, i´m not able to integrate it. can anybody help me?

Func _INIExist()
...
 
    ;shutdown-msg
    If $shutdown = 1 Then
            $msg = StringReplace($inimsg, "[CRLF]", @CRLF)
            Opt("OnExitFunc", "endscript")
        Else
            Exit
    EndIf
 
EndFunc
 
Func _OldIniExist()
...
 
                    ;Shutdown   
                    If GUICtrlRead($cbshutdown) = 1 Then
                            IniWrite(@ScriptDir & "\" & $ini, "Display before Shutdown", "Display before Shutdown", "1")
                            $editmsg = GUICtrlRead($edit, 1)
                            IniWrite(@ScriptDir & "\" & $ini, "Display before Shutdown", "Shutdown-Msg", StringReplace($editmsg, @CRLF, "[CRLF]"))
                                While 1
                                    $msg = TrayGetMsg()
                                        Select
                                            Case $msg = 0
                                                ContinueLoop
                                            Case $msg = $trayedit
                                                $flag = True
                                                DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 2000, "long", 0x00080000)
                                                WinActivate($gui)
                                                ExitLoop
                                            Case $msg = $trayexit
                                                Exit
                                        EndSelect
                                WEnd
                        Else
                            IniWrite(@ScriptDir & "\" & $ini, "Display before Shutdown", "Display before Shutdown", "0")
                            FileDelete(@TempDir & "\Henkel2.jpg")
                                $portal = IniRead(@scriptdir & "\" & $ini, "Close Windows after Start", "Portal", "0")
                                $info = IniRead(@scriptdir & "\" & $ini, "Close Windows after Start", "HDInfo", "0")
                                $install = IniRead(@scriptdir & "\" & $ini, "Close Windows after Start", "Install/Error", "0")
                                $backup = IniRead(@scriptdir & "\" & $ini, "Run after Start", "Notes Backup", "0")
                                $notes = IniRead(@scriptdir & "\" & $ini, "Run after Start", "Lotus Notes", "0")
                                $ieaxx = IniRead(@scriptdir & "\" & $ini, "IE-Settings", "IE Access", "0")
                                $portalaxx = IniRead(@scriptdir & "\" & $ini, "IE-Settings", "Portal Access", "0")
                                $RunOwnTools = IniRead(@scriptdir & "\" & $ini, "Run after Start", "Own Tools", "0")
                                $RunUrls = IniRead(@scriptdir & "\" & $ini, "Run after Start", "Run Urls", "0")
                            If $RunOwnTools = "0" And $RunURLs = "0" And $portal = "0" And $info = "0" And $install = "0" And $backup = "0" And $notes = "0" And $ieaxx = "0" And $portalaxx = "0" Then
                                    FileDelete(@scriptdir &  "\" & $ini)
                                    Exit
                                Else
                                    Exit
                            EndIf
                    EndIf
                    FileDelete(@TempDir & "\Henkel2.jpg")
        EndSelect   
    WEnd
EndFunc
 
.....
.....
 
;Shutdown-Funktion
Func endscript()
While 1
    $msg = TrayGetMsg()
        Select
            Case $msg = 0
                ContinueLoop
            Case $msg = $trayedit
                $flag = True
                _OldIniExist()
            Case $msg = $trayexit
                Exit
        EndSelect
WEnd
    If @exitMethod = 4 Then
            TraySetState(4)
            $inimsg = IniRead(@scriptdir & "\" & $ini, "Display before Shutdown", "Shutdown-Msg", "")
            $msg = StringReplace($inimsg, "[CRLF]", @CRLF)
            $cu = MsgBox(262144, "Remember", $msg)
        Else
    EndIf
EndFunc

i did a lot of changes in the script, this is my last version ... maybe it is a very bad way. but i think in this version it is not possible, to jump out of the endscript-function to the _OldIniExist-funtion.

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