JRSmile Posted September 20, 2005 Posted September 20, 2005 (edited) Hi, this is my first post here but i visit this forum often more then four times a day, i'm now at a point i don't see any other way then asking YOU to solve my problem. Problem: i want to create a tray menu with the help of an ini file which includes the sectionnames which work like entries in the root menu and subcategories as key values. nearly everything works now but i can't assign the menu to events because they have all the same variable. would be nice if someone shows me a way to create variablenames just from any other input i make, for example a ini file some kind of dialog or tcp connections etc. here my code: #Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $array_menu = IniReadSectionNames(@ScriptDir & "\menu.ini") If @error Then MsgBox(4096, "", "Error occured, probably no INI file.") Else For $i = 1 To $array_menu[0] $array_created_menus = TrayCreateMenu($array_menu[$i]) $array_keys = IniReadSection(@ScriptDir & "\menu.ini", $array_menu[$i]) For $u = 1 To $array_keys[0][0] $array_created_keys = TrayCreateItem($array_keys[$u][0],$array_created_menus) Next EndIf i trust in u people.... kind regards JRSmile EDIT: please move it to v3_beta_support .... Edited September 20, 2005 by JRSmile $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Wb-FreeKill Posted September 20, 2005 Posted September 20, 2005 (edited) Okay im not the guru when coding this stuff, but did my best, i think this should do what your asking for.. take a look:Tray_stuff.au3Ini File[Menu1]MenuItem1 = 0MenuItem2 = 0[Menu2]MenuItem1 = 0MenuItem2 = 0[Menu3]MenuItem1 = 0MenuItem2 = 0[Menu4]MenuItem1 = 0MenuItem2 = 0[Menu5]MenuItem1 = 0MenuItem2 = 0 Edited September 20, 2005 by Wb-FreeKill
Danny35d Posted September 20, 2005 Posted September 20, 2005 (edited) Using the example of Wb-FreeKill I came out with this one.....The Menu.ini file look like:[TrayMenu]Active = ItemSpace1 =Launch at Startup = ItemInteractive = ItemVerbose = ItemSpace2 = Destination = MenuSet Destination... = MenuItemView Destination... = MenuItemPurge Destination... = MenuItemSpace3 =Force Backup = MenuForce Monthly... = MenuItemForce Weekly... = MenuItemForce Daily... = MenuItemForce EveryTime... = MenuItemSpace4 = View Timestamps... = ItemView Last Backup Log... = ItemEdit File List... = ItemSpace5 = Home Page... = ItemAbout... = ItemHelp... = ItemSpace6 =Exit = ItemThe above example will create this menu:Edit post: Make the script smaller and worked faster by removing two for loop and adding IniRead. Edited September 21, 2005 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Nuffilein805 Posted September 22, 2005 Posted September 22, 2005 just do: dim $array_created_menus[100] dim $array_created_keys[100] #Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1); Default tray menu items (Script Paused/Exit) will not be shown. $array_menu = IniReadSectionNames(@ScriptDir & "\menu.ini") If @error Then MsgBox(4096, "", "Error occured, probably no INI file.") Else For $i = 1 To $array_menu[0] $array_created_menus[$i] = TrayCreateMenu($array_menu[$i]) $array_keys = IniReadSection(@ScriptDir & "\menu.ini", $array_menu[$i]) For $u = 1 To $array_keys[0][0] $array_created_keys[$u] = TrayCreateItem($array_keys[$u][0],$array_created_menus) Next EndIf this should do the job for your creation if you have more than 1 ini-section the rest is up to you my little chatmy little encryption toolmy little hidermy unsafe clickbot
JRSmile Posted October 11, 2005 Author Posted October 11, 2005 thank you so much guys ... it helped me a lot... FYI: our whole firm now uses autoit as primary script language $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now