Jump to content

Recommended Posts

Posted

I've been looking at msdn and searching around, I though maybe I can put a input as an entry into the traymenu but it's not working a bit, here something I tried.

#NoTrayIcon
Opt("TrayMenuMode",1)
$exititem = TrayCreateItem("Exit")
$handle = TrayItemGetHandle( 0 )
$form = GUICreate( "df", 12, 12, 0, 0,-1, -1, $handle )
GUICtrlCreateInput( "dfs", 0, 0 )
TraySetState()
While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $exititem
            ExitLoop
    EndSelect
    Sleep(10)
WEnd
Exit

Thanks guys

Check out ConsultingJoe.com
Posted

very tricky, but possible. Your best bet to go at this is to create a GUI that appears when someone clicks the tray icon. There's an example somewhere in the Example Scripts you could use.

Posted (edited)

I don't understand the bizarre little GUI. Here's another shot at it:

$form = GUICreate("df", 120, 120, 100, 100)
$Input = GUICtrlCreateInput("dfs", 10, 10, 100, 20)
$Button = GUICtrlCreateButton("Enter", 20, 80, 80, 30)

Opt("TrayMenuMode", 1)
$inputitem = TrayCreateItem("Input")
$exititem = TrayCreateItem("Exit")
TraySetState()

While 1
    Switch TrayGetMsg()
        Case $inputitem
            _GetInput()
        Case $exititem
            Exit
    EndSwitch
    Sleep(10)
WEnd

Func _GetInput()
    GUISetState(@SW_SHOW, $form)
    While 1
        If GUIGetMsg() = $Button Then
            MsgBox(64, "Input", "Input was:  " & GUICtrlRead($Input))
            GUISetState(@SW_HIDE, $form)
            Return
        EndIf
    WEnd
EndFunc   ;==>_GetInput

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

I don't understand the bizarre little GUI. Here's another shot at it:

$form = GUICreate("df", 120, 120, 100, 100)
$Input = GUICtrlCreateInput("dfs", 10, 10, 100, 20)
$Button = GUICtrlCreateButton("Enter", 20, 80, 80, 30)

Opt("TrayMenuMode", 1)
$inputitem = TrayCreateItem("Input")
$exititem = TrayCreateItem("Exit")
TraySetState()

While 1
    Switch TrayGetMsg()
        Case $inputitem
            _GetInput()
        Case $exititem
            Exit
    EndSwitch
    Sleep(10)
WEnd

Func _GetInput()
    GUISetState(@SW_SHOW, $form)
    While 1
        If GUIGetMsg() = $Button Then
            MsgBox(64, "Input", "Input was:  " & GUICtrlRead($Input))
            GUISetState(@SW_HIDE, $form)
            Return
        EndIf
    WEnd
EndFunc   ;==>_GetInput

:)

I wanted the Input in the actual menu. Thanks though.

@Chip

Yeah I was going to do that but I wanted to know if it can be done the nicer, more standard way. That was it's cleaner and I don't have to write the entire behavior of how its going to be placed, etc. Plus I can't figure out how to make the buttons rollover highlight and be completely flat without border.

Thanks

Check out ConsultingJoe.com

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...