Jump to content

Gui Objects in the tray?


Recommended Posts

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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

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...