Jump to content

Recommended Posts

Posted (edited)

My tray menu is created from an ini file, and it's created from the code below:

#Include <Constants.au3>
#include <TrayConstants.au3>
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode",1)

Global $IniFile = "Test.ini"
Global $var = IniReadSection($iniFile, "RADIOS")

If FileExists($iniFile) Then
    If Not @error Then
        For $i = 1 To $var[0][0]
            $TrayEntries = TrayCreateItem($var[$i][0])
        Next
    EndIf
EndIf

Shouldn't the code below delete all entries?

For $i = 1 To $var[$i][0]
    TrayItemDelete($var[$i][0])
Next

How can i delete all tray items?

 

INI File:

[RADIOS]
TEST1=text1
TEST2=text2
TEST3=text3

The menu created is:

TEST1
TEST2
TEST3

Edited by telmob
Posted (edited)
1 hour ago, telmob said:

Shouldn't the code below delete all entries?

For $i = 1 To $var[$i][0]
    TrayItemDelete($var[$i][0])
Next

TrayItemDelete expects the controlID of the TrayItem. You are using $var[$i][0], which is a keyname from the .ini file.

Furthermore : For $i = 1 To $var[$i][0] ==> For $i = 1 To $var[0][0]

Edited by Musashi
Posted
4 minutes ago, Musashi said:

TrayItemDelete expects the controlID of the TrayItem. You are using $var[$i][0], which is a keyname from the .ini file.

Ahh... i knew i was missing something.

Got it working. Thanks!

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
×
×
  • Create New...