Sign in to follow this  
Followers 0
rawrr

Help with tray

6 posts in this topic

Hello. I have made a tray menu, that changes text in a file when you click on a tray "item" I want to make it so a tray "item" says add and when you click it.. It brings up with textbox, where you type in what you want to save, then type name.. and save.. and then it stays there forever.. How would I do this?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

#Include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$google   = TrayCreateItem("google")
traycreateitem("")


$exit   = traycreateitem("Exit")

TraySetState()
; Check if file opened for writing OK

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        case $msg = $google
         $f1 = FileOpen("C:\sites.txt", 2)
         
If $f1 = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($f1, "www.google.com")
        
        
        Case $msg = $Exit
            ExitLoop
    EndSelect
WEnd

Exit

Edited by rawrr

Share this post


Link to post
Share on other sites

Anyone?? =[

Share this post


Link to post
Share on other sites

Bump. =[ please guys, somebody has to know.

Share this post


Link to post
Share on other sites

I made something for you i hope it is what you are looking for

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         Pimmetje
 Date          29 - 02 - 2008

 Script Function:
 Write some input text into a file open from de sys tray

#ce ----------------------------------------------------------------------------

Opt("TrayMenuMode",1)
$addnewline   = TrayCreateItem("add new line")
$exit   = TrayCreateItem("Exit")

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = $exit
            ExitLoop
        case $msg = $addnewline
            addtofile(InputBox ( "Add a new line", "What do you want to add to the file?" ))
    EndSelect
WEnd
        
Func addToFile($line)
; Check if file opened for writing OK
    $file = FileOpen("test.txt", 1)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
; Need  @CR And @LF else windows don't get the new line
    FileWrite($file, @CR&@LF& $line)
    FileClose($file)
EndFunc

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  
Followers 0