Jump to content

Recommended Posts

Posted (edited)

Ok. Ive had a request from a friend. Heres what I want to do

I 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
WEnd

And 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 :P

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 by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Posted (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 by Valuater

NEWHeader1.png

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...