Jump to content

Tray item problem


Recommended Posts

ok here's my problem. I have tray items made using an array.

Opt("TrayMenuMode",1)
;read from url.iniini file
$names = IniReadSectionNames( "url.ini" )


$trayurl = TrayCreateMenu( " Change URL ")
TrayCreateItem("")
For $names1 = 1 To $names[0]
    $traylist = TrayCreateItem( $names[$names1], $trayurl)
Next
$exittray = TrayCreateItem("Exit")
TraySetState()

Do
    $msgt = TrayGetMsg()
        Select
               Case $msgt = $traylist
                ;HERES WHERE I NEED HELP
                Case $msgt = $exittray
                    Exit

the url.ini file:

[Address 1]
ip=google.com
[Address 2]
ip=google.ca
[Address 3]
ip=google.co.uk
[Address 4]
ip=google.org

ok so where it says: HERES WHERE I NEED HELP on the top most script, this is want i want done there.

i need to get the name of the tray item the user clicked, lets say they clicked "Address 3", then i want the program to read the 'ip' value that goes with that name, so at "Address 3" we have 'google.co.uk'.

the problem is the program only does what it's supposed to do when i select the last tray item generated, so when i click "Address 4", it works, but not when i click any of the other entries.

after the program reads the value at ip value "address # clicked' i want the program to open ie to that address.

Thanks to anyone that can help me.

"The quieter you are, the more you are able to hear..."

My AppsUSB Finder

Link to comment
Share on other sites

Try this

Opt("TrayMenuMode",1)
;read from url.iniini file
$names = IniReadSectionNames( "url.ini" )


$trayurl = TrayCreateMenu( " Change URL ")
TrayCreateItem("")
Dim $Traylist[$Names[0]+1]
For $i = 1 To $names[0]
    $traylist[$i] = TrayCreateItem( $names[$i], $trayurl)
Next
$exittray = TrayCreateItem("Exit")
TraySetState()

Do
    $msgt = TrayGetMsg()
    For $a = 1 to $Names[0]
        If $Msgt = $Traylist[$a] Then
            $Address = IniRead("Url.ini", $Names[$a], "ip", "~~Error~~")
            MsgBox(0,"",$Address)
        EndIf
    Next
Until $Msgt = $Exittray
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...