Jump to content
Sign in to follow this  
AzKay

Cant really explain, Basically, Its got:

Recommended Posts

AzKay

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

Share this post


Link to post
Share on other sites
Valuater

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

Share this post


Link to post
Share on other sites
AzKay

Works great. Thanks Val. =3


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.