bb01 Posted October 18, 2010 Share Posted October 18, 2010 hi folks, Ok the problem i'm having, is that i need to add an ini file eg.. the name is links.ini & have the right click menu read the links & place them into the web section of the right click menu.. Have tried a number of things & all seem not to do anything, eg.. can get it to read the links.ini, but then it doesnt put it into the menu... heres the right click menu:- expandcollapse popup#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=psi-32x32.ico #AutoIt3Wrapper_outfile=PSIrightclick.exe #AutoIt3Wrapper_Compression=4 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #NoTrayIcon Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $Otheritem = TrayCreateMenu("Other Tools") $Cleanup1item = TrayCreateItem("AutoAntiVirus", $Otheritem) TrayCreateItem("") $Webitem = TrayCreateMenu("Web Links") ;add new links here, read from links.ini $Web1item = TrayCreateItem("N-Focus", $Webitem) $Web2item = TrayCreateItem("Database", $Webitem) $Web3item = TrayCreateItem("ADP", $Webitem) $Web4item = TrayCreateItem("SecureMail", $Webitem) $Web5item = TrayCreateItem("Policy Log", $Webitem) $Web6item = TrayCreateItem("Sector Website", $Webitem) $Web7item = TrayCreateItem("SkillPort / SkillSoft", $Webitem) $Web8item = TrayCreateItem("PSInside", $Webitem) TrayCreateItem("") $Driveitem = TrayCreateMenu("Drives") $Drive1item = TrayCreateItem("G Drive", $Driveitem) $Drive2item = TrayCreateItem("U Drive", $Driveitem) TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() TraySetClick(16) While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem ShellExecute(@ScriptDir & "\graphic.exe") Case $msg = $exititem ExitLoop Case $msg = $Web1item ShellExecute("https://****************************") Case $msg = $exititem ExitLoop Case $msg = $Web2item ShellExecute("https://****************************") Case $msg = $exititem ExitLoop Case $msg = $Web3item ShellExecute("https://****************************") Case $msg = $exititem ExitLoop Case $msg = $Web4item ShellExecute("https://****************************") Case $msg = $exititem ExitLoop Case $msg = $Web5item ShellExecute("https://****************************") Case $msg = $exititem ExitLoop Case $msg = $Web6item ShellExecute("https://****************************") Case $msg = $exititem ExitLoop Case $msg = $Web7item ShellExecute("https://****************************") Case $msg = $exititem ExitLoop Case $msg = $Web8item ShellExecute("https://****************************") Case $msg = $exititem ExitLoop Case $msg = $Cleanup1item ShellExecute(@ScriptDir & "\AutoAntiVirus.exe") Case $msg = $exititem ExitLoop Case $msg = $Drive1item ShellExecute("\\fs1neoma\Data") Case $msg = $exititem ExitLoop Case $msg = $Drive2item ShellExecute("U:\") Case $msg = $exititem ExitLoop EndSelect WEnd Exit heres a copy of the links.ini $Web1Name = Name Of Site $Web1Addy = http://******************* $Web2Name = Name Of Site $Web2Addy = http://******************* $Prog1Name = AutoIt3 $Prog1Addy = C:\Program Files\AutoIt3\AutoIt3.exe $Prog2Name = AutoIt Info Tool $Prog2Addy = C:\Program Files\AutoIt3\Au3Info.exe Any help would really be usefull, as i'm also thinking that this same thing could help with program shortcut menus etc... & if we can add links in the links.ini then people can add there own sites, programs etc... Link to comment Share on other sites More sharing options...
Affe Posted October 18, 2010 Share Posted October 18, 2010 1) That's not really an ini file. An ini file looks like this: [vars] vars[0][0]=vars[0][1] vars[1][0]=vars[1][1] [vars2] vars2[0][0]=vars2[0][1] vars2[1][0]=vars2[1][1] etc.... 2) Once you have your ini file set up properly, it will be as easy as using a For loop to read the data from the array at the time you populate the menu and insert them that way. [center][/center] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 18, 2010 Moderators Share Posted October 18, 2010 bb01,Nice try! Post a script which makes no mention of an ini file, IniRead or anything other than a few TrayMenu commands alongside a skeleton ini file. And then sit back and wait for someone to produce a script to tie it all together as described in the text. But alas, you are going to have do some work yourself: can get it to read the links.iniWhere? it doesnt put it into the menuWhat have you tried? Over to you. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
Affe Posted October 18, 2010 Share Posted October 18, 2010 (edited) 1) That's not really an ini file. An ini file looks like this: [vars] vars[0][0]=vars[0][1] vars[1][0]=vars[1][1] [vars2] vars2[0][0]=vars2[0][1] vars2[1][0]=vars2[1][1] etc.... You can set this up however you like, but for yours, I personally would do: [Sites] SiteName1=http://******************* SiteName2=http://******************* [Programs] AutoIt3=C:\Program Files\AutoIt3\AutoIt3.exe AutoIt Info Tool=C:\Program Files\AutoIt3\Au3Info.exe 2) Once you have your ini file set up properly, it will be as easy as using a For loop to read the data from the array at the time you populate the menu and insert them that way. This post was an accident as was supposed to be an edit :/ Edited October 18, 2010 by Affe [center][/center] Link to comment Share on other sites More sharing options...
bb01 Posted October 18, 2010 Author Share Posted October 18, 2010 (edited) melba32, yes i have been trying thins, for example... I had tried quite a few things, was getting confused with why it was not showing, for example, had it $Input1 = IniRead(@ScriptDir & "\links.ini", "Web", "Web1Name", "Web2Name" & "Web3Name" & "Web4Name", "NotFound") $Input2 = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog1Name", "Prog2Name" & "Prog3Name" & "Prog4Name", "NotFound") Also Tried ;$var1 = IniReadSectionNames(@ScriptDir & "\links.ini") $var1 = IniRead(@ScriptDir & "\links.ini", "Web", "", "NotFound") If @error Then MsgBox(4096, "", "Error occurred, Make sure the links.ini is in the same folder as PSIrightclick.exe") Else For $i = 1 To $var1[0] MsgBox(4096, "", $var1[$i]) ;(Keep this in so can see if working), then will use the $var1 in the links section, Next EndIf With the above, would always get it, showing not found.. So was getting more than just confused, and sometimes its easier to strip out the stuff that you know is wrong, or is just not working & show what is working, & see if someone can help from there... [Web] $Web1Name = Name Of Site $Web1Addy = http://******************* $Web2Name = Name Of Site $Web2Addy = http://******************* [Prog] $Prog1Name = AutoIt3 $Prog1Addy = C:\Program Files\AutoIt3\AutoIt3.exe $Prog2Name = AutoIt Info Tool $Prog2Addy = C:\Program Files\AutoIt3\Au3Info.exe Edited October 18, 2010 by bb01 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 18, 2010 Moderators Share Posted October 18, 2010 bb01,That is not the syntax to read an Ini file - you can only read one value at a time, like this:$sWeb1Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web1Name", "NotFound") $sProg1Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog1Name", "NotFound")Do the same for the other values. Then when you have all your variables filled you can use them to insert items into your menu.Give that a try and see how you get on. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
bb01 Posted October 18, 2010 Author Share Posted October 18, 2010 (edited) thanks, got it working now, will post full script tommorow, as gotta go work now.. that was what got it working for me, so yes Melba23 sometimes just removing the code & redoing it, and asking for a bit of help, can solve everything... $sWeb1Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web1Name", "NotFound") Thanks again... Edited October 18, 2010 by bb01 Link to comment Share on other sites More sharing options...
bb01 Posted October 20, 2010 Author Share Posted October 20, 2010 (edited) got 2 quick q's. 1st:- for normal cmd etc we would use %windir%\notepad.exe to get to the notepad is there a way to be able to do that in the ini files? as in the ini files it seems to need full links, eg. C:\Windows\Notepad.exe 2nd how do i stop it showing ticks in the right click, as when a link or item it run, it places a tick next to it.. Thanks for this this is how the script looks:- expandcollapse popup#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=psi-32x32.ico #AutoIt3Wrapper_outfile=PSIrightclick.exe #AutoIt3Wrapper_Compression=4 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #NoTrayIcon Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. ;$sWeb1Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web1Name", "NotFound") ;Program Names $sProg1Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog1Name", "NotFound") $sProg2Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog2Name", "NotFound") $sProg3Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog3Name", "NotFound") ;User Program Names $sProg4Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog4Name", "NotFound") $sProg5Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog5Name", "NotFound") $sProg6Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog6Name", "NotFound") $sProg7Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog7Name", "NotFound") $sProg8Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog8Name", "NotFound") $sProg9Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog9Name", "NotFound") $sProg10Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog10Name", "NotFound") $sProg11Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog11Name", "NotFound") $sProg12Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog12Name", "NotFound") $sProg13Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog13Name", "NotFound") $sProg14Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog14Name", "NotFound") $sProg15Name = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog15Name", "NotFound") ;Program Links $sProg1Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog1Link", "NotFound") $sProg2Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog2Link", "NotFound") $sProg3Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog3Link", "NotFound") ;User Program Links $sProg4Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog4Link", "NotFound") $sProg5Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog5Link", "NotFound") $sProg6Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog6Link", "NotFound") $sProg7Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog7Link", "NotFound") $sProg8Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog8Link", "NotFound") $sProg9Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog9Link", "NotFound") $sProg10Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog10Link", "NotFound") $sProg11Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog11Link", "NotFound") $sProg12Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog12Link", "NotFound") $sProg13Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog13Link", "NotFound") $sProg14Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog14Link", "NotFound") $sProg15Link = IniRead(@ScriptDir & "\links.ini", "Prog", "Prog15Link", "NotFound") ; Website Names $sWeb1Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web1Name", "NotFound") $sWeb2Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web2Name", "NotFound") $sWeb3Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web3Name", "NotFound") $sWeb4Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web4Name", "NotFound") $sWeb5Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web5Name", "NotFound") $sWeb6Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web6Name", "NotFound") $sWeb7Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web7Name", "NotFound") $sWeb8Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web8Name", "NotFound") $sWeb9Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web9Name", "NotFound") $sWeb10Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web10Name", "NotFound") $sWeb11Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web11Name", "NotFound") $sWeb12Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web12Name", "NotFound") $sWeb13Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web13Name", "NotFound") $sWeb14Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web14Name", "NotFound") $sWeb15Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web15Name", "NotFound") $sWeb16Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web16Name", "NotFound") $sWeb17Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web17Name", "NotFound") $sWeb18Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web18Name", "NotFound") $sWeb19Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web19Name", "NotFound") $sWeb20Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web20Name", "NotFound") $sWeb21Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web21Name", "NotFound") $sWeb22Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web22Name", "NotFound") $sWeb23Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web23Name", "NotFound") $sWeb24Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web24Name", "NotFound") $sWeb25Name = IniRead(@ScriptDir & "\links.ini", "Web", "Web25Name", "NotFound") ;Website Address'S $sWeb1Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web1Addy", "NotFound") $sWeb2Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web2Addy", "NotFound") $sWeb3Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web3Addy", "NotFound") $sWeb4Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web4Addy", "NotFound") $sWeb5Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web5Addy", "NotFound") $sWeb6Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web6Addy", "NotFound") $sWeb7Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web7Addy", "NotFound") $sWeb8Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web8Addy", "NotFound") $sWeb9Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web9Addy", "NotFound") $sWeb10Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web10Addy", "NotFound") $sWeb11Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web11Addy", "NotFound") $sWeb12Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web12Addy", "NotFound") $sWeb13Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web13Addy", "NotFound") $sWeb14Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web14Addy", "NotFound") $sWeb15Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web15Addy", "NotFound") $sWeb16Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web16Addy", "NotFound") $sWeb17Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web17Addy", "NotFound") $sWeb18Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web18Addy", "NotFound") $sWeb19Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web19Addy", "NotFound") $sWeb20Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web20Addy", "NotFound") $sWeb21Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web21Addy", "NotFound") $sWeb22Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web22Addy", "NotFound") $sWeb23Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web23Addy", "NotFound") $sWeb24Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web24Addy", "NotFound") $sWeb25Addy = IniRead(@ScriptDir & "\links.ini", "Web", "Web25Addy", "NotFound") ;Program Names $sDrive1Name = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive1Name", "NotFound") $sDrive2Name = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive2Name", "NotFound") $sDrive3Name = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive3Name", "NotFound") $sDrive4Name = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive4Name", "NotFound") $sDrive5Name = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive5Name", "NotFound") ;Drive Address'S $sDrive1Addy = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive1Addy", "NotFound") $sDrive2Addy = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive2Addy", "NotFound") $sDrive3Addy = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive3Addy", "NotFound") $sDrive4Addy = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive1Addy", "NotFound") $sDrive5Addy = IniRead(@ScriptDir & "\links.ini", "Drive", "Drive2Addy", "NotFound") If @error Then MsgBox(4096, "", "Error occurred, Make sure the links.ini is in the same folder as PSIrightclick.exe") Else ;MsgBox(4096, "", $sWeb1Name) EndIf $Otheritem = TrayCreateMenu("Programs") $Prog1item = TrayCreateItem($sProg1Name, $Otheritem) $Prog2item = TrayCreateItem($sProg2Name, $Otheritem) $Prog3item = TrayCreateItem($sProg3Name, $Otheritem) $Otheritem2 = TrayCreateMenu("User Programs") $Prog4item = TrayCreateItem($sProg4Name, $Otheritem2) $Prog5item = TrayCreateItem($sProg5Name, $Otheritem2) $Prog6item = TrayCreateItem($sProg6Name, $Otheritem2) $Prog7item = TrayCreateItem($sProg7Name, $Otheritem2) $Prog8item = TrayCreateItem($sProg8Name, $Otheritem2) $Prog9item = TrayCreateItem($sProg9Name, $Otheritem2) $Prog10item = TrayCreateItem($sProg10Name, $Otheritem2) $Prog11item = TrayCreateItem($sProg11Name, $Otheritem2) $Prog12item = TrayCreateItem($sProg12Name, $Otheritem2) $Prog13item = TrayCreateItem($sProg13Name, $Otheritem2) $Prog14item = TrayCreateItem($sProg14Name, $Otheritem2) $Prog15item = TrayCreateItem($sProg15Name, $Otheritem2) TrayCreateItem("") $Webitem = TrayCreateMenu("Web Links") $Web1item = TrayCreateItem($sWeb1Name, $Webitem) $Web2item = TrayCreateItem($sWeb2Name, $Webitem) $Web3item = TrayCreateItem($sWeb3Name, $Webitem) $Web4item = TrayCreateItem($sWeb4Name, $Webitem) $Web5item = TrayCreateItem($sWeb5Name, $Webitem) $Web6item = TrayCreateItem($sWeb6Name, $Webitem) $Web7item = TrayCreateItem($sWeb7Name, $Webitem) $Web8item = TrayCreateItem($sWeb8Name, $Webitem) $Web9item = TrayCreateItem($sWeb9Name, $Webitem) $Webitem2 = TrayCreateMenu("User Web Links") $Web10item = TrayCreateItem($sWeb10Name, $Webitem2) $Web11item = TrayCreateItem($sWeb11Name, $Webitem2) $Web12item = TrayCreateItem($sWeb12Name, $Webitem2) $Web13item = TrayCreateItem($sWeb13Name, $Webitem2) $Web14item = TrayCreateItem($sWeb14Name, $Webitem2) $Web15item = TrayCreateItem($sWeb15Name, $Webitem2) $Web16item = TrayCreateItem($sWeb16Name, $Webitem2) $Web17item = TrayCreateItem($sWeb17Name, $Webitem2) $Web18item = TrayCreateItem($sWeb18Name, $Webitem2) $Web19item = TrayCreateItem($sWeb19Name, $Webitem2) $Web20item = TrayCreateItem($sWeb20Name, $Webitem2) $Web21item = TrayCreateItem($sWeb21Name, $Webitem2) $Web22item = TrayCreateItem($sWeb22Name, $Webitem2) $Web23item = TrayCreateItem($sWeb23Name, $Webitem2) $Web24item = TrayCreateItem($sWeb24Name, $Webitem2) $Web25item = TrayCreateItem($sWeb25Name, $Webitem2) TrayCreateItem("") $Driveitem = TrayCreateMenu("Drives") $Drive1item = TrayCreateItem($sDrive1Name, $Driveitem) $Drive2item = TrayCreateItem($sDrive2Name, $Driveitem) $Drive3item = TrayCreateItem($sDrive3Name, $Driveitem) $Drive4item = TrayCreateItem($sDrive4Name, $Driveitem) $Drive5item = TrayCreateItem($sDrive5Name, $Driveitem) TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() TraySetClick(16) While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem ShellExecute(@ScriptDir & "\graphic.exe") Case $msg = $exititem ExitLoop Case $msg = $Web1item ShellExecute($sWeb1Addy) Case $msg = $exititem ExitLoop Case $msg = $Web2item ShellExecute($sWeb2Addy) Case $msg = $exititem ExitLoop Case $msg = $Web3item ShellExecute($sWeb3Addy) Case $msg = $exititem ExitLoop Case $msg = $Web4item ShellExecute($sWeb4Addy) Case $msg = $exititem ExitLoop Case $msg = $Web5item ShellExecute($sWeb5Addy) Case $msg = $exititem ExitLoop Case $msg = $Web6item ShellExecute($sWeb6Addy) Case $msg = $exititem ExitLoop Case $msg = $Web7item ShellExecute($sWeb7Addy) Case $msg = $exititem ExitLoop Case $msg = $Web8item ShellExecute($sWeb8Addy) Case $msg = $exititem ExitLoop Case $msg = $Web9item ShellExecute($sWeb9Addy) Case $msg = $exititem ExitLoop Case $msg = $Web10item ShellExecute($sWeb10Addy) Case $msg = $exititem ExitLoop Case $msg = $Web11item ShellExecute($sWeb11Addy) Case $msg = $exititem ExitLoop Case $msg = $Web12item ShellExecute($sWeb12Addy) Case $msg = $exititem ExitLoop Case $msg = $Web13item ShellExecute($sWeb13Addy) Case $msg = $exititem ExitLoop Case $msg = $Web14item ShellExecute($sWeb14Addy) Case $msg = $exititem ExitLoop Case $msg = $Web15item ShellExecute($sWeb15Addy) Case $msg = $exititem ExitLoop Case $msg = $Web16item ShellExecute($sWeb16Addy) Case $msg = $exititem ExitLoop Case $msg = $Web17item ShellExecute($sWeb17Addy) Case $msg = $exititem ExitLoop Case $msg = $Web18item ShellExecute($sWeb18Addy) Case $msg = $exititem ExitLoop Case $msg = $Web19item ShellExecute($sWeb19Addy) Case $msg = $exititem ExitLoop Case $msg = $Web20item ShellExecute($sWeb20Addy) Case $msg = $exititem ExitLoop Case $msg = $Web21item ShellExecute($sWeb21Addy) Case $msg = $exititem ExitLoop Case $msg = $Web22item ShellExecute($sWeb22Addy) Case $msg = $exititem ExitLoop Case $msg = $Web23item ShellExecute($sWeb23Addy) Case $msg = $exititem ExitLoop Case $msg = $Web24item ShellExecute($sWeb24Addy) Case $msg = $exititem ExitLoop Case $msg = $Web25item ShellExecute($sWeb25Addy) Case $msg = $exititem ExitLoop ;--------------------------------------------------------- ; Begin Programs ;--------------------------------------------------------- Case $msg = $Prog1item ShellExecute($sProg1Link) Case $msg = $exititem ExitLoop Case $msg = $Prog2item ShellExecute($sProg2Link) Case $msg = $exititem ExitLoop Case $msg = $Prog3item ShellExecute($sProg3Link) Case $msg = $exititem ExitLoop Case $msg = $Prog4item ShellExecute($sProg4Link) Case $msg = $exititem ExitLoop Case $msg = $Prog5item ShellExecute($sProg5Link) Case $msg = $exititem ExitLoop Case $msg = $Prog6item ShellExecute($sProg6Link) Case $msg = $exititem ExitLoop Case $msg = $Prog7item ShellExecute($sProg7Link) Case $msg = $exititem ExitLoop Case $msg = $Prog8item ShellExecute($sProg8Link) Case $msg = $exititem ExitLoop Case $msg = $Prog9item ShellExecute($sProg9Link) Case $msg = $exititem ExitLoop Case $msg = $Prog10item ShellExecute($sProg10Link) Case $msg = $exititem ExitLoop Case $msg = $Prog11item ShellExecute($sProg11Link) Case $msg = $exititem ExitLoop Case $msg = $Prog12item ShellExecute($sProg12Link) Case $msg = $exititem ExitLoop Case $msg = $Prog13item ShellExecute($sProg13Link) Case $msg = $exititem ExitLoop Case $msg = $Prog14item ShellExecute($sProg14Link) Case $msg = $exititem ExitLoop Case $msg = $Prog15item ShellExecute($sProg15Link) Case $msg = $exititem ExitLoop ;--------------------------------------------------------- ; Begin Drives ;--------------------------------------------------------- Case $msg = $Drive1item ShellExecute($sDrive1Addy) Case $msg = $exititem ExitLoop Case $msg = $Drive2item ShellExecute($sDrive1Addy) Case $msg = $exititem ExitLoop Case $msg = $Drive3item ShellExecute($sDrive3Addy) Case $msg = $exititem ExitLoop Case $msg = $Drive4item ShellExecute($sDrive4Addy) Case $msg = $exititem ExitLoop Case $msg = $Drive5item ShellExecute($sDrive5Addy) Case $msg = $exititem ExitLoop EndSelect WEnd Exit & this is how the ini looks:- expandcollapse popup[Web] Web1Name = N-Focus Web1Addy = http://******************* Web2Name = Database Web2Addy = http://******************* Web3Name = ADP Web3Addy = http://******************* Web4Name = SecureMail Web4Addy = http://******************* Web5Name = Policy Log Web5Addy = http://******************* Web6Name = Sector Website Web6Addy = http://******************* Web7Name = SkillPort / SkillSoft Web7Addy = http://******************* Web8Name = PSInside Web8Addy = http://******************* Web9Name = Enter New Site Here Web9Addy = http://******************* Web10Name = Enter New Site Here Web10Addy = http://******************* Web11Name = Enter New Site Here Web11Addy = http://******************* Web12Name = Enter New Site Here Web12Addy = http://******************* Web13Name = Enter New Site Here Web13Addy = http://******************* Web14Name = Enter New Site Here Web14Addy = http://******************* Web15Name = Enter New Site Here Web15Addy = http://******************* Web10Name = Enter New Site Here Web10Addy = http://******************* Web11Name = Enter New Site Here Web11Addy = http://******************* Web12Name = Enter New Site Here Web12Addy = http://******************* Web13Name = Enter New Site Here Web13Addy = http://******************* Web14Name = Enter New Site Here Web14Addy = http://******************* Web15Name = Enter New Site Here Web15Addy = http://******************* Web16Name = Enter New Site Here Web16Addy = http://******************* Web17Name = Enter New Site Here Web17Addy = http://******************* Web18Name = Enter New Site Here Web18Addy = http://******************* Web19Name = Enter New Site Here Web19Addy = http://******************* Web20Name = Enter New Site Here Web20Addy = http://******************* Web21Name = Enter New Site Here Web21Addy = http://******************* Web22Name = Enter New Site Here Web22Addy = http://******************* Web23Name = Enter New Site Here Web23Addy = http://******************* Web24Name = Enter New Site Here Web24Addy = http://******************* Web25Name = Enter New Site Here Web25Addy = http://******************* [Prog] Prog1Name = Auto Antivirus Prog1Link = AutoAv.exe Prog2Name = Notepad Prog2Link = Notepad+\notepad++.exe Prog3Name = Calc Prog3Link = C:\Windows\system32\calc.exe Prog4Name = Enter Your Own Program Prog4Link = C:\ Prog5Name = Enter Your Own Program Prog5Link = C:\ Prog6Name = Enter Your Own Program Prog6Link = C:\ Prog7Name = Enter Your Own Program Prog7Link = C:\ Prog8Name = Enter Your Own Program Prog8Link = C:\ Prog9Name = Enter Your Own Program Prog9Link = C:\ Prog10Name = Enter Your Own Program Prog10Link = C:\ Prog11Name = Enter Your Own Program Prog11Link = C:\ Prog12Name = Enter Your Own Program Prog12Link = C:\ Prog13Name = Enter Your Own Program Prog13Link = C:\ Prog14Name = Enter Your Own Program Prog14Link = C:\ Prog15Name = Enter Your Own Program Prog15Link = C:\ [Drive] Drive1Name = G Drive Drive1Addy = G:\ Drive2Name = U Drive Drive2Addy = U:\ Drive3Name = Put Your Own Drive Of Folder Here Drive3Addy =C:\ Drive4Name = Put Your Own Drive Of Folder Here Drive4Addy = C:\ Drive5Name = Put Your Own Drive Of Folder Here Drive5Addy = C:\ Edited October 20, 2010 by bb01 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 20, 2010 Moderators Share Posted October 20, 2010 bb01,My first thought on looking at your code is that you really should look into using arrays - it would simplify the script enormously and save a lot of wear and tear on your typing fingers! Anyway, to your questions: 1. - Look in the Help file under <Macro Reference - Directory> - you would need @ProgramsDir here (do not forget the "\").2. - To prevent the ticks, use Opt("TrayMenuMode", 2).M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
bb01 Posted October 20, 2010 Author Share Posted October 20, 2010 ok, the 1st problem i found was when i used @scriptdir\notepad\notepad.exe It popped up error saying "unable to execute @scriptdir\notepad\notepad.exe" but will keep on playing around with that... Link to comment Share on other sites More sharing options...
bb01 Posted October 20, 2010 Author Share Posted October 20, 2010 ok, changed it to Opt("TrayMenuMode", 2). & that now removed the Tick marks, but now shows the script paused So can i somehow combine Opt("TrayMenuMode", 1). & Opt("TrayMenuMode", 2). together? as i've tried Opt("TrayMenuMode", 1,2). & that just errors out.. I added also Opt("TrayAutoPause",0) ;0=no pause, 1=Pause As with option 2, it would autopause.. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 20, 2010 Moderators Share Posted October 20, 2010 (edited) bb01,Sorry, I suggested using @ProgramDir but you actually need @WindowsDir - certainly not @ScriptDir! And you need to concatenate. Tyr using @WindowsDir & "\Notepad.exe".M23Edit: Just add the TrayMenuMode parameters as it says in the Help file:Extend the behaviour of the script tray icon/menu. This can be done with a combination (adding) of the following values.So you would need Opt("TrayMenuMode", 3). Edited October 20, 2010 by Melba23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
saywell Posted October 20, 2010 Share Posted October 20, 2010 So can i somehow combine Opt("TrayMenuMode", 1). & Opt("TrayMenuMode", 2). together?as i've tried Opt("TrayMenuMode", 1,2). & that just errors out..From the helpfiles:Extend the behaviour of the script tray icon/menu. This can be done with a combination (adding) of the following values.1+2=3William Link to comment Share on other sites More sharing options...
GEOSoft Posted October 20, 2010 Share Posted October 20, 2010 Extend the behaviour of the script tray icon/menu. This can be done with a combination (adding) of the following values.So your first attempt would have beenOpt("TrayMenuMode", 3) ;1 + 2 = 3In your case you didn't need the 1 anyway so I'm just pointing out the way to do what you attempted. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
bb01 Posted October 20, 2010 Author Share Posted October 20, 2010 ahhh always forget about that.. having to add them together.. lol Ok Melba23, @WindowsDir & "\Notepad.exe". doesnt work inside the ini files.. so now have tried.. @WindowsDir & "\Notepad.exe". @WindowsDir\Notepad.exe "@WindowsDir\Notepad.exe" $windir$\notepad.exe %windir%\notepad.exe seems none of them work.. but am still playing around trying to get them to work.. & only reason i said about the @scriptdir not working, as tried that aswell.. lol Link to comment Share on other sites More sharing options...
Tvern Posted October 20, 2010 Share Posted October 20, 2010 (edited) At the risk of M23 slapping me around for writing code for you I couldn't resist giving an example of how you could improve this using arrays.Make sure you understand how an array stores data and how a for loop can be used to iterate through them.While saywell's example of 1+2=3 will work, it's best to get in the habbit of combining styles using BitOr (used in the example).Example:expandcollapse popup#RequireAdmin #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=psi-32x32.ico #AutoIt3Wrapper_outfile=PSIrightclick.exe #AutoIt3Wrapper_Compression=4 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <array.au3> #NoTrayIcon Opt("TrayMenuMode", BitOR(1, 2)) ;Combined style 1 and 2 using BitOr ;Check if the file exists If Not FileExists(@ScriptDir & "\links.ini") Then MsgBox(4096, "", "Error occurred, Make sure the links.ini is in the same folder as PSIrightclick.exe") Exit EndIf ;read sections into 2D arrays. $aProg = IniReadSection(@ScriptDir & "\links.ini", "Prog") $aUserProg = IniReadSection(@ScriptDir & "\links.ini", "UserProg") $aWeb = IniReadSection(@ScriptDir & "\links.ini", "Web") $aUserWeb = IniReadSection(@ScriptDir & "\links.ini", "UserWeb") $aDrive = IniReadSection(@ScriptDir & "\links.ini", "Drive") ;uncomment the next lines to see the resulting arrays ;~ _ArrayDisplay($aProg,"$aProg") ;~ _ArrayDisplay($aUserProg,"$aUserProg") ;~ _ArrayDisplay($aWeb,"$aWeb") ;~ _ArrayDisplay($aUserWeb,"$aUserWeb") ;~ _ArrayDisplay($aDrive,"$aDrive") ;create items for entries in the ini If IsArray($aProg) Then $Otheritem = TrayCreateMenu("Programs") For $i = 1 To $aProg[0][0] $aProg[$i][0] = TrayCreateItem($aProg[$i][0], $Otheritem) ;the name of the program is replaced by the ID of the control. The link stays in the array. Next EndIf If IsArray($aUserProg) Then $Otheritem2 = TrayCreateMenu("User Programs") For $i = 1 To $aUserProg[0][0] $aUserProg[$i][0] = TrayCreateItem($aUserProg[$i][0], $Otheritem2) Next EndIf If IsArray($aProg) Or IsArray($aUserProg) Then TrayCreateItem("") ;only create the dividing line if items are present If IsArray($aWeb) Then $Webitem = TrayCreateMenu("Web Links") For $i = 1 To $aWeb[0][0] $aWeb[$i][0] = TrayCreateItem($aWeb[$i][0], $Webitem) Next EndIf If IsArray($aUserWeb) Then $Webitem2 = TrayCreateMenu("User Web Links") For $i = 1 To $aUserWeb[0][0] $aUserWeb[$i][0] = TrayCreateItem($aUserWeb[$i][0], $Webitem2) Next EndIf If IsArray($aWeb) Or IsArray($aUserWeb) Then TrayCreateItem("") If IsArray($aDrive) Then $Driveitem = TrayCreateMenu("Drives") For $i = 1 To $aDrive[0][0] $aDrive[$i][0] = TrayCreateItem($aDrive[$i][0], $Driveitem) Next TrayCreateItem("") EndIf $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() TraySetClick(16) ;uncomment the next lines to see the modified arrays. Now ith CtrlId's where the names used to be ;~ _ArrayDisplay($aProg,"$aProg") ;~ _ArrayDisplay($aUserProg,"$aUserProg") ;~ _ArrayDisplay($aWeb,"$aWeb") ;~ _ArrayDisplay($aUserWeb,"$aUserWeb") ;~ _ArrayDisplay($aDrive,"$aDrive") While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem ShellExecute(@ScriptDir & "\graphic.exe") Case $msg = $exititem ;you only need one of these ExitLoop Case Else ;check if the control ID is present in an array, $iIndex = _ArraySearch($aProg, $msg, 1) If Not @error Then ShellExecute($aProg[$iIndex][1]) ;if so execute the link that goes with it ContinueLoop EndIf $iIndex = _ArraySearch($aUserProg, $msg, 1) If Not @error Then ShellExecute($aUserProg[$iIndex][1]) ContinueLoop EndIf $iIndex = _ArraySearch($aWeb, $msg, 1) If Not @error Then ShellExecute($aWeb[$iIndex][1]) ContinueLoop EndIf $iIndex = _ArraySearch($aUserWeb, $msg, 1) If Not @error Then ShellExecute($aUserWeb[$iIndex][1]) ContinueLoop EndIf $iIndex = _ArraySearch($aDrive, $msg, 1) If Not @error Then ShellExecute($aDrive[$iIndex][1]) ContinueLoop EndIf EndSelect WEnd Exitthe example uses a different ini syntax layout as shown here:[Prog][Prog] Calculator1 = Calc.exe Calculator2 = Calc.exe Calculator3 = Calc.exe Calculator4 = Calc.exe Calculator5 = Calc.exe [UserProg] Notepad1 = Notepad.exe Notepad2 = Notepad.exe Notepad3 = Notepad.exe Notepad4 = Notepad.exe Notepad5 = Notepad.exe [Web] google1 = http://www.google.com google2 = http://www.google.com google3 = http://www.google.com google4 = http://www.google.com google5 = http://www.google.com [UserWeb] AutoIt forums1 = http://www.autoitscript.com/forum AutoIt forums2 = http://www.autoitscript.com/forum AutoIt forums3 = http://www.autoitscript.com/forum AutoIt forums4 = http://www.autoitscript.com/forum AutoIt forums5 = http://www.autoitscript.com/forum [Drive] Root1 = C:\ Root2 = C:\ Root3 = C:\ Root4 = C:\ Root5 = C:\To the left is the name shown on the control, to the right is the line that should be shelexecuted. I'm using just the filenames here, but I strongly recommend using the full path.Edit: "different ini syntax" didn't seem quite rightEdit2: Removed step value in the for loops and added more links to the example ini file. Edited October 21, 2010 by Tvern Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 20, 2010 Moderators Share Posted October 20, 2010 Tvern,At the risk of M23 slapping me around for writing code for you I couldn't resist giving an example of how you could improve this using arraysNo risk at all - always delighted to have another pair of capable hands willing to help out. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
bb01 Posted October 20, 2010 Author Share Posted October 20, 2010 Tvern have always had problems with arrays, but will play around with yours & will need to do editing etc, and then will post the outcome.. But thanks, as that does seem to help with how arrays work.. Link to comment Share on other sites More sharing options...
Bert Posted October 20, 2010 Share Posted October 20, 2010 I found this. It may be of some help http://www.autoitscript.com/forum/index.php?showtopic=39412&hl=menu++iniread++text The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
bb01 Posted October 20, 2010 Author Share Posted October 20, 2010 Tvern ok, having trouble getting this array to work.. How would i add to it, for it to read [Prog] Calculator = Calc.exe Notepad++ = Notepad++.exe [UserProg] Notepad = Notepad.exe AV = AV.exe [Web] google = http://www.google.com [UserWeb] AutoIt forums = http://www.autoitscript.com/forum [Drive] Root = C:\ do i add something else to the array, as thats where i always seem to get confused.. Thanks in advance Link to comment Share on other sites More sharing options...
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