Jump to content

Traytip event on click?


Recommended Posts

Hello,

I have written a small script to message computers across the network via traytips instead of netsend (why? Why not :P ). I'd like to add functionality to the traytip so I can send a message like "This form has been updated, click here to browse to it!", and actually browse to the directory/url/etc.

Right now the script is reading input for the text and TTL of the tip. My guess is that I'd have to append the ini I'm creating that propogates the traytip. Any ideas? This script currently works perfectly without the desired additions, in tandem with a script that runs, checking for an ini file to output to a traytip.

First script - get data

------------------------------------------------------------------------------------------------------------------

#comments-start

New and improved Message Script for Nunya Business

Authors: A couple of bored IT geeks

Date: 1-6-2006

#comments-end

;As more dells are added to the network, increase this variable to the highest dell # available

Global $HighestDellNumber = ;actual data

Global $Text

Global $ComputerToMap ;Variable for messaging only one Dell

Global $CurrentComputer ;Variable for looping through all Dells

Global $DellNumber = 0

Global $Time ; Variable to add a timeout on the popup message

;Request Computer Name

$ComputerToMap = InputBox("Message Alert", "Computer to message:")

;Request for messgage to be sent and write to ini file

$Text = InputBox("Question", "Enter Message")

IniWrite ( "C:\%folder%\todotext.ini", "Message", "text", """" & $Text & """" )

$Time = InputBox("Question", "How many seconds to show the message?")

IniWrite("C:\%folder%\todotext.ini", "Timer", "time", """" & $Time & """")

If $ComputerToMap <> "All" Then

;Test to see if computer is on the network, map drive T to computer, copy the file, and delete the drive

$MapTest = Ping($ComputerToMap, 100)

If $MapTest Then

DriveMapAdd ( "T:", "\\"& $ComputerToMap &"\c$" ,"" ,"%user", "%pass%")

TrayTip("Status", "Connected to " & $ComputerToMap, 10, 1)

Sleep(1500)

FileCopy ("C:\%folder%\todotext.ini", "T:\%folder%\stuff\*.*")

DriveMapDel ("T:")

Else

TrayTip("Status", "Unable to connect to " & $ComputerToMap, 2, 3)

Sleep(1500)

EndIf

ElseIf $ComputerToMap == "All" Then

; Add 1 to the DellNumber and attach appropriate dell string to current computer until the

; highest dell number is reached

Do

$DellNumber = $DellNumber + 1

If $DellNumber ;sensitive

ElseIf ;sensitive

ElseIf ;sensitive

EndIf

;Attach Dell number to the CurrentComputer variable

$CurrentComputer = $CurrentComputer & $DellNumber

$MapTest = Ping($CurrentComputer, 100)

If $MapTest Then

;Map drive T to current computer, copy the file, and delete the drive

DriveMapAdd ( "T:", "\\"& $CurrentComputer &"\c$" ,"" ,"%user%", "%pass%")

;Display the successful attempt

TrayTip("Status", "Connected to " & $CurrentComputer, 2, 1)

Sleep(1500)

FileCopy ("C:\%folder%\todotext.ini", "T:\%folder%\stuff\*.*")

DriveMapDel ("T:")

Else

TrayTip("Status", "Unable to connect to " & $CurrentComputer, 2, 3)

Sleep(1500)

EndIf

Until $DellNumber == $HighestDellNumber

EndIf

Exit

==========================================================

Second script - search for, output, and delete

---------------------------------------------------------------------

Opt("TrayIconHide", 1) ; Hide systray icon

AutoItWinSetTitle(@ScriptName)

Global $File1

Global $File2

Global $Message

Global $Command

Global $Timer ;timer variable

Global $Timer2 ;timer variable

While 1

$File1 = FileOpen("c:\%folder%\%folder%\todotext.ini", 0)

$File2 = FileOpen("c:\%folder%\%folder%\todocommand.ini", 0)

If $File1 <> -1 Then

$Message = IniRead("c:\%folder%\%folder%\todotext.ini", "Message", "text", "NotFound")

$Timer = IniRead("C:\%folder%\%folder%\todotext.ini", "Timer", "time", "NotFound")

$Timer2 = $Timer * 1000

Opt("TrayIconHide", 0) ; unhide systray icon

TrayTip("I'm a title", "I'm the message", 5, 1) ;this is a fake tip to allow the real one to display

TrayTip("clears any tray tip","",0) ; clear false tip from memory

TrayTip("Message", $Message, 20, 1) ; load ini file

Sleep($Timer2) ; load variable for sleep

FileClose($File1)

Opt("TrayIconHide", 1) ; Hide systray icon

FileDelete("c:\%folder%\%folder%\todotext.ini")

EndIf

If $File2 <> -1 Then

;do some other irrelevant stuff

Sleep(5000)

WEnd

---------------------

Thank you in advance!

Edited by msa2004
Link to comment
Share on other sites

since no one else is replying... i thought about how you'd do that and all i can think of is detecting if the mouse is in that area and if the user clicks. it might be a good place to start. you could look into just clicking on the tray icon with the Tray functions or maybe another alternative if you don't really get anywhere.

Edited by Oxin8
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...