Jump to content
Sign in to follow this  
IvanCodin

GUIDelete and exit

Recommended Posts

IvanCodin

I have a script where I am using GUIDelete to toggle between screens. It works but flickers between screens. Any way to delete the flicker?

I also am unable to exit with a single click if I have have moved between GUI screens. IE If I have moved between the GUI screens three times I must click the exit three times to end my script. Is there a "Global GUI Delete" command I can use instead?

Thanks

CC

Share this post


Link to post
Share on other sites
Valuater

asking us to guess what the "real" problem s.... is impossible

show code

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
IvanCodin

You had already helped me with this is the general forum.

To recap if you have switched between the GUI's you must press exit multiple times.

CODE
#Include <GUIConstantsEX.au3>

#Include <Misc.au3>

#include <Process.au3>

#cs

<=================================================================================================

=======>

Version Information

0.90.1 -> Initial version

0.90.2 -> Added Menu items

0.90.3 -> Add notes

-> Add RAS IP address

0.90.8 -> Use scriptdir

-> Check My Notes and ask if they want to save it

-> New Context menus

To Do

Verify successful RAS connection before ssh or telnet connection is attempted. <= Done

After successful connection determine the Server RAS ip address and telnet or ssh to it automatically.

Check My Note when exiting an if not empty ask them if they want to save it.

ini file to buttons, Read these from an INI file

toggle menus between two GUI windows.

=> cdr test application

<=================================================================================================

=======>

#ce

; vars

HotkeySet("^x", "_Bye")

$my_version = "0.90.8"

; Applications we will use

$treepad = "C:\Documents and Settings\cclausen\My Documents\- Tools\Treepad"

$ccconsole = @ScriptDir & "\Console.exe"

$vncviewer = @ScriptDir & "\UltraVNC\vncviewer.exe"

$keepass = @ScriptDir & "\KeePass.exe"

$stopwatch = @scriptdir & "\stopwtch.exe"

$puttycm = @scriptdir & "\puttycm.exe"

$putty = @scriptdir & "\putty.exe"

If WinExists("My Tools") Then

MsgBox(4096,"Info", "Only one copy of this application script can be run at once!!!" & @CRLF & @CRLF & " Program will now exit.", 6)

Exit

Else

EndIf

Main()

Local $contextmenu, $button, $buttoncontext, $buttonitem, $msg

Local $nessubmenu, $txtitem, $filename, $saveitem, $infoitem

Func Main()

GUIDelete()

$MainForm = GUICreate("My Tools", 499, 447, 270, 98)

GUICtrlCreateLabel("<== My Notes ==>",35,18)

$cCommand = GUICtrlCreateEdit("", 32, 40, 337, 377)

$Button0 = GUICtrlCreateButton("Copy My Notes", 392, 46, 89, 23, 0)

$Button1 = GUICtrlCreateButton("RAS", 392, 77, 89, 23, 0)

$Button2 = GUICtrlCreateButton("Putty", 392, 108, 89, 23, 0)

$Button3 = GUICtrlCreateButton("Telnet", 392, 139, 89, 23, 0)

$Button4 = GUICtrlCreateButton("VNC", 392, 170, 89, 23, 0)

$Button5 = GUICtrlCreateButton("Console 2", 392, 201, 89, 23, 0)

$Button6 = GUICtrlCreateButton("KeePass", 392, 232, 89, 23, 0)

$Button7 = GUICtrlCreateButton("Timer", 392, 263, 89, 23, 0)

$Button8 = GUICtrlCreateButton("CMD Prompt", 392, 294, 89, 23, 0)

$Button9 = GUICtrlCreateButton("Ping", 392, 325, 89, 23, 0)

$Button10 = GUICtrlCreateButton("Treepad", 392, 356, 89, 23, 0)

$Button11 = GUICtrlCreateButton("Spare", 392, 387, 89, 23, 0)

$Button12 = GUICtrlCreateButton("Second GUI", 392, 418, 89, 23, 0)

While 1

GUISetState(@SW_SHOW, $MainForm)

$msg = GUIGetMsg()

;If $msg = $Item_2 or $msg = -3 or $msg = -1 Then ExitLoop

;If $msg = -3 or $msg = -1 Then ExitLoop

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Select

;Case $msg = $GUI_EVENT_CLOSE

;Exit

;ExitLoop

Case $msg = $Button1

Run(@ScriptDir & "\RAS-Dial.exe")

If @error Then

SplashTextOn("Notice - Error", " Your RAS-Dial command failed." & @CRLF & "RAS-Dial.exe was not found." & @CRLF, 380,65)

Sleep(3000)

SplashOff()

EndIf

Case $msg = $Button2

Putty()

Case $msg = $Button3

Telnet()

Case $msg = $Button4

vnc()

Case $msg = $Button5

Run($ccconsole)

If @error Then

SplashTextOn("Notice - Error", " Your console command failed." & @CRLF & "No console application was found." & @CRLF, 380,65)

Sleep(3000)

SplashOff()

EndIf

Case $msg = $Button6

Run($keepass)

If @error Then

SplashTextOn("Notice - Error", " Your KeePass application failed." & @CRLF & "No KeePass application was found." & @CRLF, 380,65)

Sleep(3000)

SplashOff()

EndIf

Case $msg = $Button7

Run($stopwatch)

If @error Then

SplashTextOn("Notice - Error", " Your stopwatch command failed." & @CRLF & "No stopwatch application was found." & @CRLF, 380,65)

Sleep(3000)

SplashOff()

EndIf

Case $msg = $Button8

Run("cmd")

Case $msg = $Button9

Pinger()

Case $msg = $Button10

Treepad()

Case $msg = $Button11

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button12

GUIDelete()

Second()

Case $msg = $Button0

ClipPut("") ; clear to prevent duplicate entries

ClipPut(GuiCtrlRead($cCommand) & @CRLF)

If (@Error ==1) Then

Msgbox(0, "", "Unable to copy to the ClipBoard.")

EndIf

;EndSelect

Sleep (2000)

EndSelect

WEnd ; end Main menu

EndFunc

#cs

Begin new window here with new button items

#ce

Func Second()

$SecondForm = GUICreate("My Tools", 499, 447, 270, 98)

GUISwitch ($SecondForm)

GUISetState(@SW_SHOW, $SecondForm)

GUICtrlCreateLabel("<== Second page ==>",35,18)

$cCommand = GUICtrlCreateEdit("", 32, 40, 337, 377)

;ClipPut("") ; clear to prevent duplicate entries

;ClipPut(GuiCtrlRead($cCommand) & @CRLF

$Button20 = GUICtrlCreateButton("Copy My Notes", 392, 46, 89, 23, 0)

$Button21 = GUICtrlCreateButton("Button 21", 392, 77, 89, 23, 0)

$Button22 = GUICtrlCreateButton("Button 22", 392, 108, 89, 23, 0)

$Button23 = GUICtrlCreateButton("Button 23", 392, 139, 89, 23, 0)

$Button24 = GUICtrlCreateButton("Button 24", 392, 170, 89, 23, 0)

$Button25 = GUICtrlCreateButton("Button 25", 392, 201, 89, 23, 0)

$Button26 = GUICtrlCreateButton("Button 26", 392, 232, 89, 23, 0)

$Button27 = GUICtrlCreateButton("Button 27", 392, 263, 89, 23, 0)

$Button28 = GUICtrlCreateButton("Button 28", 392, 294, 89, 23, 0)

$Button29 = GUICtrlCreateButton("Button 29", 392, 325, 89, 23, 0)

$Button30 = GUICtrlCreateButton("Button 30", 392, 356, 89, 23, 0)

$Button31 = GUICtrlCreateButton("Button 31", 392, 387, 89, 23, 0)

$Button32 = GUICtrlCreateButton("Return to Main", 392, 418, 89, 23, 0)

While 1

;GUISetState(@SW_SHOW)

$msg = GUIGetMsg()

;If $msg = $Item_2 or $msg = -3 or $msg = -1 Then ExitLoop

;If $msg = -3 or $msg = -1 Then ExitLoop

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Select

;Case $msg = $GUI_EVENT_CLOSE

;Exit

;ExitLoop

Case $msg = $Button20

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button21

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button22

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button23

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button24

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button25

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button26

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button27

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button28

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button29

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button30

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button31

MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button32

GUIDelete()

Main()

;MsgBox(4096,"Info", "Not yet implemented", 3)

Case $msg = $Button20

ClipPut("") ; clear to prevent duplicate entries

ClipPut(GuiCtrlRead($cCommand) & @CRLF)

If (@Error ==1) Then

Msgbox(0, "", "Unable to copy to the ClipBoard.")

EndIf

;EndSelect

Sleep (2000)

EndSelect

WEnd ; end main menu

EndFunc

Func Telnet()

$ip = InputBox("IP", "Enter IP to connect to", @IPAddress1)

If (@Error ==1) Then

Msgbox(0, "", "canceled.")

return 0

EndIf

run("telnet " & $ip)

If @error Then

SplashTextOn("Notice - Error", " Your telnet command failed." & @CRLF & "No telent command avaliable.", 380,65)

Sleep(3000)

SplashOff()

EndIf

EndFunc ; telnet

Func PuttyCM()

run($PuttyCM)

If @error Then

SplashTextOn("Notice - Error", " Your PuttyCM application failed." & @CRLF & "No PuttyCM application was found.", 380,65)

Sleep(3000)

SplashOff()

EndIf

EndFunc ; ==> PuttyCM

Func Putty()

$ssh = InputBox("IP", "Enter IP to connect to", @IPAddress1)

If (@Error ==1) Then

Msgbox(0, "", "Canceled.")

return 0

EndIf

run("putty " & $ssh)

If @error Then

SplashTextOn("Notice - Error", " Your putty command failed." & @CRLF & "No putty command avaliable.", 380,65)

Sleep(3000)

SplashOff()

EndIf

EndFunc ; ==> Putty

Func vnc()

$servername = InputBox("IP", "Enter IP to connect to", @IPAddress1)

If (@Error ==1) Then

Msgbox(0, "", "Canceled.")

return 0

EndIf

run($vncviewer & " " & $servername)

If @error Then

SplashTextOn("Notice - Error", " Your Ultravnc command failed." & @CRLF & "No UltraVNC command avaliable.", 380,65)

Sleep(3000)

SplashOff()

EndIf

EndFunc ; ==> vnc

Func Treepad()

; run($treepad)

ShellExecute ($treepad)

If @error Then

SplashTextOn("Notice - Error", " Treepad failed." & @CRLF & "No Treepad application avaliable.", 380,65)

Sleep(3000)

SplashOff()

EndIf

EndFunc ; ==> Treepad

Func Pinger()

$ip = InputBox("IP", "Enter IP address you wish to ping")

If (@Error ==1) Then

Msgbox(4096, "", "Canceled.")

return 0

EndIf

run("ping " & $ip)

EndFunc ; ==> Pinger

Func dbg($msg)

DllCall("kernel32.dll", "none", "OutputDebugString", "str", $msg)

EndFunc

Func _About()

MsgBox(0, "About", "My Tool Box " & $my_version, 4)

EndFunc ; ==> _About

Func _Bye()

;SoundPlay(@WindowsDir & "\media\tada.wav",1)

MsgBox(0, "Bye", "Exiting program", 4)

Exit

EndFunc ;==> _Bye

Func _Exit ()

;$info = ClipGet()

;If clipboard is not empty do you want to save?

;if (GuiCtrlRead($cCommand)) == "" Then

; continue

;Else

; MsgBox(4096,"Info", "My Notes is not empty!!", 3)

;EndIf

Exit

EndFunc ; ==> _Exit

Share this post


Link to post
Share on other sites
Valuater

Well I see you went with message rather than event...

I think I fixed the trouble here too!

#include <GUIConstantsEX.au3>
#include <Misc.au3>
#include <Process.au3>

#cs
    <=================================================================================================
    =======>
    Version Information
    0.90.1 -> Initial version
    
    0.90.2 -> Added Menu items
    
    0.90.3 -> Add notes
    -> Add RAS IP address
    
    0.90.8 -> Use scriptdir
    -> Check My Notes and ask if they want to save it
    -> New Context menus
    
    To Do
    Verify successful RAS connection before ssh or telnet connection is attempted. <= Done
    After successful connection determine the Server RAS ip address and telnet or ssh to it automatically.
    Check My Note when exiting an if not empty ask them if they want to save it.
    ini file to buttons, Read these from an INI file
    toggle menus between two GUI windows.
    => cdr test application
    <=================================================================================================
    =======>
#ce
; vars
HotKeySet("^x", "_Bye")
$my_version = "0.90.8"

; Applications we will use
$treepad = "C:\Documents and Settings\cclausen\My Documents\- Tools\Treepad"
$ccconsole = @ScriptDir & "\Console.exe"
$vncviewer = @ScriptDir & "\UltraVNC\vncviewer.exe"
$keepass = @ScriptDir & "\KeePass.exe"
$stopwatch = @ScriptDir & "\stopwtch.exe"
$puttycm = @ScriptDir & "\puttycm.exe"
$putty = @ScriptDir & "\putty.exe"

If WinExists("My Tools") Then
    MsgBox(4096, "Info", "Only one copy of this application script can be run at once!!!" & @CRLF & @CRLF & " Program will now exit.", 6)
    Exit
Else
EndIf

Local $contextmenu, $button, $buttoncontext, $buttonitem, $msg
Local $nessubmenu, $txtitem, $filename, $saveitem, $infoitem


GUIDelete()
$MainForm = GUICreate("My Tools", 499, 447, 270, 98)

GUICtrlCreateLabel("<== My Notes ==>", 35, 18)
$cCommand = GUICtrlCreateEdit("", 32, 40, 337, 377)
$Button0 = GUICtrlCreateButton("Copy My Notes", 392, 46, 89, 23, 0)
$Button1 = GUICtrlCreateButton("RAS", 392, 77, 89, 23, 0)
$Button2 = GUICtrlCreateButton("Putty", 392, 108, 89, 23, 0)
$Button3 = GUICtrlCreateButton("Telnet", 392, 139, 89, 23, 0)
$Button4 = GUICtrlCreateButton("VNC", 392, 170, 89, 23, 0)
$Button5 = GUICtrlCreateButton("Console 2", 392, 201, 89, 23, 0)
$Button6 = GUICtrlCreateButton("KeePass", 392, 232, 89, 23, 0)
$Button7 = GUICtrlCreateButton("Timer", 392, 263, 89, 23, 0)
$Button8 = GUICtrlCreateButton("CMD Prompt", 392, 294, 89, 23, 0)
$Button9 = GUICtrlCreateButton("Ping", 392, 325, 89, 23, 0)
$Button10 = GUICtrlCreateButton("Treepad", 392, 356, 89, 23, 0)
$Button11 = GUICtrlCreateButton("Spare", 392, 387, 89, 23, 0)
$Button12 = GUICtrlCreateButton("Second GUI", 392, 418, 89, 23, 0)
GUISetState(@SW_SHOW, $MainForm); not in a loop

$SecondForm = GUICreate("My Tools", 499, 447, 270, 98)
GUICtrlCreateLabel("<== Second page ==>", 35, 18)
$cCommand = GUICtrlCreateEdit("", 32, 40, 337, 377)
;ClipPut("") ; clear to prevent duplicate entries
;ClipPut(GuiCtrlRead($cCommand) & @CRLF
$Button20 = GUICtrlCreateButton("Copy My Notes", 392, 46, 89, 23, 0)
$Button21 = GUICtrlCreateButton("Button 21", 392, 77, 89, 23, 0)
$Button22 = GUICtrlCreateButton("Button 22", 392, 108, 89, 23, 0)
$Button23 = GUICtrlCreateButton("Button 23", 392, 139, 89, 23, 0)
$Button24 = GUICtrlCreateButton("Button 24", 392, 170, 89, 23, 0)
$Button25 = GUICtrlCreateButton("Button 25", 392, 201, 89, 23, 0)
$Button26 = GUICtrlCreateButton("Button 26", 392, 232, 89, 23, 0)
$Button27 = GUICtrlCreateButton("Button 27", 392, 263, 89, 23, 0)
$Button28 = GUICtrlCreateButton("Button 28", 392, 294, 89, 23, 0)
$Button29 = GUICtrlCreateButton("Button 29", 392, 325, 89, 23, 0)
$Button30 = GUICtrlCreateButton("Button 30", 392, 356, 89, 23, 0)
$Button31 = GUICtrlCreateButton("Button 31", 392, 387, 89, 23, 0)
$Button32 = GUICtrlCreateButton("Return to Main", 392, 418, 89, 23, 0)
GUISetState(@SW_HIDE, $SecondForm); not in a loop

While 1

    $msg = GUIGetMsg()
    ;If $msg = $Item_2 or $msg = -3 or $msg = -1 Then ExitLoop
    ;If $msg = -3 or $msg = -1 Then ExitLoop
    ;If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
            ;ExitLoop
        Case $msg = $Button1
            Run(@ScriptDir & "\RAS-Dial.exe")
            If @error Then
                SplashTextOn("Notice - Error", " Your RAS-Dial command failed." & @CRLF & "RAS-Dial.exe was not found." & @CRLF, 380, 65)
                Sleep(3000)
                SplashOff()
            EndIf
        Case $msg = $Button2
            Putty()
        Case $msg = $Button3
            Telnet()
        Case $msg = $Button4
            vnc()
        Case $msg = $Button5
            Run($ccconsole)
            If @error Then
                SplashTextOn("Notice - Error", " Your console command failed." & @CRLF & "No console application was found." & @CRLF, 380, 65)
                Sleep(3000)
                SplashOff()
            EndIf
        Case $msg = $Button6
            Run($keepass)
            If @error Then
                SplashTextOn("Notice - Error", " Your KeePass application failed." & @CRLF & "No KeePass application was found." & @CRLF, 380, 65)
                Sleep(3000)
                SplashOff()
            EndIf
        Case $msg = $Button7
            Run($stopwatch)
            If @error Then
                SplashTextOn("Notice - Error", " Your stopwatch command failed." & @CRLF & "No stopwatch application was found." & @CRLF, 380, 65)
                Sleep(3000)
                SplashOff()
            EndIf
        Case $msg = $Button8
            Run("cmd")
        Case $msg = $Button9
            Pinger()
        Case $msg = $Button10
            Treepad()
        Case $msg = $Button11
            MsgBox(4096, "Info", "Not yet implemented", 3)
        Case $msg = $Button12
            GUISetState(@SW_HIDE, $MainForm)
            Second()
            GUISetState(@SW_SHOW, $MainForm)
        Case $msg = $Button0
            ClipPut("") ; clear to prevent duplicate entries
            ClipPut(GUICtrlRead($cCommand) & @CRLF)
            If (@error == 1) Then
                MsgBox(0, "", "Unable to copy to the ClipBoard.")
            EndIf
            ;EndSelect
            Sleep(2000)
    EndSelect
WEnd ; end Main menu

Func Second()

    While 1
        GUISetState(@SW_SHOW, $SecondForm)
        $msg2 = GUIGetMsg()
        ;If $msg = $Item_2 or $msg = -3 or $msg = -1 Then ExitLoop
        ;If $msg = -3 or $msg = -1 Then ExitLoop
        ;If $msg2 = $GUI_EVENT_CLOSE Then ExitLoop
        Select
            ;Case $msg = $GUI_EVENT_CLOSE
            ;Exit
            ;ExitLoop
            Case $msg2 = $Button20
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button21
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button22
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button23
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button24
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button25
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button26
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button27
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button28
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button29
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button30
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button31
                MsgBox(4096, "Info", "Not yet implemented", 3)
            Case $msg2 = $Button32 Or $msg2 = $GUI_EVENT_CLOSE
                GUISetState(@SW_HIDE, $SecondForm)
                Return
                ;MsgBox(4096,"Info", "Not yet implemented", 3)
            Case $msg = $Button20
                ClipPut("") ; clear to prevent duplicate entries
                ClipPut(GUICtrlRead($cCommand) & @CRLF)
                If (@error == 1) Then
                    MsgBox(0, "", "Unable to copy to the ClipBoard.")
                EndIf
                ;EndSelect
                Sleep(2000)
        EndSelect
    WEnd ; end main menu
EndFunc   ;==>Second

Func Telnet()
    $ip = InputBox("IP", "Enter IP to connect to", @IPAddress1)
    If (@error == 1) Then
        MsgBox(0, "", "canceled.")
        Return 0
    EndIf
    Run("telnet " & $ip)
    If @error Then
        SplashTextOn("Notice - Error", " Your telnet command failed." & @CRLF & "No telent command avaliable.", 380, 65)
        Sleep(3000)
        SplashOff()
    EndIf
EndFunc   ;==>Telnet

Func PuttyCM()
    Run($puttycm)
    If @error Then
        SplashTextOn("Notice - Error", " Your PuttyCM application failed." & @CRLF & "No PuttyCM application was found.", 380, 65)
        Sleep(3000)
        SplashOff()
    EndIf
EndFunc   ;==>PuttyCM

Func Putty()
    $ssh = InputBox("IP", "Enter IP to connect to", @IPAddress1)
    If (@error == 1) Then
        MsgBox(0, "", "Canceled.")
        Return 0
    EndIf
    Run("putty " & $ssh)
    If @error Then
        SplashTextOn("Notice - Error", " Your putty command failed." & @CRLF & "No putty command avaliable.", 380, 65)
        Sleep(3000)
        SplashOff()
    EndIf
EndFunc   ;==>Putty

Func vnc()
    $servername = InputBox("IP", "Enter IP to connect to", @IPAddress1)
    If (@error == 1) Then
        MsgBox(0, "", "Canceled.")
        Return 0
    EndIf
    Run($vncviewer & " " & $servername)
    If @error Then
        SplashTextOn("Notice - Error", " Your Ultravnc command failed." & @CRLF & "No UltraVNC command avaliable.", 380, 65)
        Sleep(3000)
        SplashOff()
    EndIf
EndFunc   ;==>vnc

Func Treepad()
    ; run($treepad)
    ShellExecute($treepad)
    If @error Then
        SplashTextOn("Notice - Error", " Treepad failed." & @CRLF & "No Treepad application avaliable.", 380, 65)
        Sleep(3000)
        SplashOff()
    EndIf
EndFunc   ;==>Treepad

Func Pinger()
    $ip = InputBox("IP", "Enter IP address you wish to ping")
    If (@error == 1) Then
        MsgBox(4096, "", "Canceled.")
        Return 0
    EndIf
    Run("ping " & $ip)
EndFunc   ;==>Pinger


Func dbg($msg)
    DllCall("kernel32.dll", "none", "OutputDebugString", "str", $msg)
EndFunc   ;==>dbg

Func _About()
    MsgBox(0, "About", "My Tool Box " & $my_version, 4)
EndFunc   ;==>_About

Func _Bye()
    ;SoundPlay(@WindowsDir & "\media\tada.wav",1)
    MsgBox(0, "Bye", "Exiting program", 4)
    Exit
EndFunc   ;==>_Bye

Func _Exit()
    ;$info = ClipGet()
    ;If clipboard is not empty do you want to save?
    ;if (GuiCtrlRead($cCommand)) == "" Then
    ; continue
    ;Else
    ; MsgBox(4096,"Info", "My Notes is not empty!!", 3)
    ;EndIf
    Exit
EndFunc   ;==>_Exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
IvanCodin

Thanks!!! I'll look at the changes(s) you made and see what I did incorrectly.

I did decide to use message rather than event mode. I will most likely switch to event mode later but would like you opinion as to whether you think it would be better for this type of script.

CC

Share this post


Link to post
Share on other sites
IvanCodin

Your changes worked perfectly, Thanks. However it created a new issue. Maybe I too picky but here goes ....

If I open the script and reposition the window then click Second GUI button it opens in the Second GUI in the default location (centered on the screen). Is the second gui considered a child GUI? I have been looking in the forums to see if there are reference to winowd positions abed on a parent window.

I found this function in the forums:

Func _Win_GetChildPos($h_parent, $h_child)

Local $h_wnd = ControlGetHandle($h_parent, "", $h_child)

Return WinGetPos($h_wnd)

EndFunc

But I am not sure how I would use it.

CC

Share this post


Link to post
Share on other sites
IvanCodin

Where do I put this in the script?

I changed:

$SecondForm = GUICreate("My Tools", 499, 447, 270, 98)

GUICtrlCreateLabel("<== Second page ==>", 35, 18)

to:

$SecondForm = GUICreate("My Tools", 499, 447, 270, 98)

$Pos = WinGetPos($MainForm)

WinMove($SecondForm, "", $Pos[0], $Pos[1])

GUICtrlCreateLabel("<== Second page ==>", 35, 18)

It did not work.

CC

Share this post


Link to post
Share on other sites
Valuater

you have to place it in the Function Second

Func Second()

While 1

GUISetState(@SW_SHOW, $SecondForm)

after "Function" and before "While"

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
IvanCodin

I absolutely don't understand what it does but it work perfectly!!!!!

Many Many thanks!!

CC

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  

×