AzKay Posted December 20, 2006 Posted December 20, 2006 (edited) Ok. Ive had a request from a friend. Heres what I want to doI make a file, called links.txt, And I put a new url on each line, then I thought of making this:#include <File.au3> Opt("TrayMenuMode", 1) Global $Tray $Lines = _FileCountLines("Links.txt") For $i = 1 To $Lines $Tray[$i] = TrayCreateItem(FileReadLine("Links.txt", $i)) Next While 1 For $i = 1 To $Lines $nMsg = TrayGetMsg() Switch $nMsg Case $Tray[$i] ShellExecute(FileReadLine("Links.txt", $i)) EndSwitch Next WEndAnd hoping that it would make a new tray item for each link in the links.txt, But, My experiment failed. Any ideas of how I would accomplish this?Yes, I know nothing about arrays Edit::Looking at my script again, Ive realized, That is one hopeless script. Any ideas of how I would make the script?I cant set an ammount of TrayCreateItem()'s Because, it will always be a different amount of links. Edited December 20, 2006 by AzKay # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Valuater Posted December 20, 2006 Posted December 20, 2006 (edited) Maybe.... #include <File.au3> Opt("TrayMenuMode", 1) Global $Tray_List Global $file = @ScriptDir & "\Links.txt" If Not _FileReadToArray($file,$Tray_List) Then MsgBox(4096,"Error", " Error reading file to Array error:" & @error) Exit EndIf Dim $Tray[UBound($Tray_List) + 1] For $i = 1 To UBound($Tray_List) -1 $Tray[$i] = TrayCreateItem($Tray_List[$i]) Next While 1 For $i = 1 To UBound($Tray_List) -1 $nMsg = TrayGetMsg() Switch $nMsg Case $Tray[$i] ShellExecute($Tray_List[$i]) EndSwitch Next WEnd ************** NOT TESTED BTW i would put the TrayGetMsg() outside the loop 8) Edited December 20, 2006 by Valuater
AzKay Posted December 20, 2006 Author Posted December 20, 2006 Works great. Thanks Val. =3 # MY LOVE FOR YOU... IS LIKE A TRUCK- #
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