Jump to content

Recommended Posts

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

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

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

    No registered users viewing this page.

×
×
  • Create New...