jvanegmond Posted October 11, 2007 Share Posted October 11, 2007 (edited) Based on Ibraham's script: Put the attached icon.ico file in the same directory as the script. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.9.2 (beta) Author: Jos van Egmond Script Function: This is a script that watches your net sessions. It will Tray Tip the currently open connections. #ce ---------------------------------------------------------------------------- Opt("TrayMenuMode",1) Opt("TrayOnEventMode", 1) #include <Constants.au3> #include <Array.au3> TraySetIcon("icon.ico") TraySetToolTip("Share Watcher") $tExit = TrayCreateItem("Exit") TrayItemSetOnEvent($tExit,"Close") While 1 $sSessions = GetSessions() If Not @error Then TrayTip("Share Watcher", $sSessions,5) EndIf Sleep(1000) WEnd Func GetSessions() Local $sBuffer = "", $sReturn = "" $pPID = Run("net session","",@SW_HIDE,$STDOUT_CHILD) While 1 $sBuffer &= StdoutRead($pPID) If @error Then ExitLoop WEnd $sSplit = StringSplit(StringStripCR($sBuffer),@LF) If $sSplit[0] > 3 Then For $x = 1 to $sSplit[0] If StringLeft($sSplit[$x],2) = "\\" Then $sTemp = StringSplit($sSplit[$x]," ",1) $sTemp = _ArrayDeleteEmpty($sTemp) ;_ArrayDisplay($sTemp) $sReturn &= $sTemp[2] & " on computer " & StringTrimLeft($sTemp[1],2) & " is looking." & @CRLF EndIf Next $sReturn = StringTrimRight($sReturn,2) Else Return SetError(1,0,0) EndIf Return $sReturn EndFunc Func _ArrayDeleteEmpty($aArray) Local $aReturn[1], $i = 0 For $x = 0 to UBound($aArray)-1 If $aArray[$x] <> "" Then $aReturn[$i] = $aArray[$x] $i += 1 ReDim $aReturn[$i+1] EndIf Next Return $aReturn EndFunc Func Close() Exit EndFunc Edited March 21, 2018 by jvanegmond github.com/jvanegmond Link to comment Share on other sites More sharing options...
gseller Posted October 11, 2007 Share Posted October 11, 2007 Cool, I 'll have to take this to work to checkit out.. LOL Looks pretty nice.. Link to comment Share on other sites More sharing options...
Ibrahim Posted October 11, 2007 Share Posted October 11, 2007 (edited) Well Thank you for saying my NAME, I did it with the help of Smashly too ,I did so Little thing i know it's not that great but it's a must,it doesn't block viewing the files but it terminate Copy procedure.Or it can be put in the loop to keep blocking it here it's expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.9.2 (beta) Author: Manadar Script Function: This is a script that watches your net sessions. It will Tray Tip the currently open connections. #ce ---------------------------------------------------------------------------- Opt("TrayMenuMode",1) Opt("TrayOnEventMode", 1) #include <Constants.au3> #include <Array.au3> $I=1 TraySetIcon($I&".ico") TraySetToolTip("Share Watcher") $tExit = TrayCreateItem("Exit") $Kill=TrayCreateItem("Terminate Session");<<<<<<<<<<<<----------------------------------------- TrayItemSetState($Kill,$TRAY_DISABLE) TrayItemSetOnEvent($tExit,"Close") TrayItemSetOnEvent($Kill,"Terminate") While 1 $sSessions = GetSessions() If Not @error Then AnimateIcon();<<<<<<<<<<<<----------------------------------------- TrayTip("Share Watcher", $sSessions,5) TrayItemSetState($Kill,$TRAY_ENABLE);<<<<<<<<<<<<----------------------------------------- EndIf Sleep(500) TraySetIcon("1.ico") WEnd Func AnimateIcon();<<<<<<<<<<<<----------------------------------------- For $I=1 to 4 sleep(500) TraySetIcon($I&".ico") Next EndFunc Func GetSessions() Local $sBuffer = "", $sReturn = "" $pPID = Run("net session","",@SW_HIDE,$STDOUT_CHILD) While 1 $sBuffer &= StdoutRead($pPID) If @error Then ExitLoop WEnd $sSplit = StringSplit(StringStripCR($sBuffer),@LF) If $sSplit[0] > 3 Then For $x = 1 to $sSplit[0] If StringLeft($sSplit[$x],2) = "\\" Then $sTemp = StringSplit($sSplit[$x]," ",1) $sTemp = _ArrayDeleteEmpty($sTemp) ;_ArrayDisplay($sTemp) $sReturn &= $sTemp[2] & " on computer " & StringTrimLeft($sTemp[1],2) & " is looking." & @CRLF EndIf Next $sReturn = StringTrimRight($sReturn,2) Else Return SetError(1,0,0) EndIf Return $sReturn EndFunc Func _ArrayDeleteEmpty($aArray) Local $aReturn[1], $i = 0 For $x = 0 to UBound($aArray)-1 If $aArray[$x] <> "" Then $aReturn[$i] = $aArray[$x] $i += 1 ReDim $aReturn[$i+1] EndIf Next Return $aReturn EndFunc Func Close() Exit EndFunc Func Terminate();<<<<<<<<<<<<----------------------------------------- Run("net session /delete") EndFunc Hope u like it Edit Added Animated icons(Should be included) and i guess i shoulf have put this in a Dll file but wait till finished i guess.! 1.ico 2.ico 3.ico 4.ico Edited March 21, 2018 by Melba23 User name removed by request [font="Arial Black"]My Stuff[/font]UPnP Port Forwarding Final.GateWay InformationThe GateWay Watcher(detect speeofing)Rightclick Any file --->Hide/UnhideThe Tip WatcherA PanelShare WatcherThe Arp WatcherThe Online License Checker Link to comment Share on other sites More sharing options...
jvanegmond Posted October 11, 2007 Author Share Posted October 11, 2007 Ibrahim, I really like the moving icons, but I think you can make it simpler. I'll look into that later. I don't even think the net session /delete command disallows another user to view your files. They will just open a new connection. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Ibrahim Posted October 11, 2007 Share Posted October 11, 2007 u can add Net share /delete or net share user or something it's easy and like i said i abort only the copy stream [font="Arial Black"]My Stuff[/font]UPnP Port Forwarding Final.GateWay InformationThe GateWay Watcher(detect speeofing)Rightclick Any file --->Hide/UnhideThe Tip WatcherA PanelShare WatcherThe Arp WatcherThe Online License Checker Link to comment Share on other sites More sharing options...
corz Posted October 11, 2007 Share Posted October 11, 2007 This is nice, but remember, many users have balloon tips disabled. I do, and all I got was DING! DING! DING! and all my regular tray tips disabled. TraySetToolTip always works (afaik) but is limited to 128 chrs, rather than 255. I switched it to this, and almsot got a full three lines in my tip. Without the "on computer" part in the text, I got three full lines no problem. It's okay to put linefeeds in regular tray tips, too. Definitely handy, but without the DING! ;o) (or nothing is foolproof to the sufficiently talented fool.. Link to comment Share on other sites More sharing options...
Ibrahim Posted October 12, 2007 Share Posted October 12, 2007 to those with balloon tips disabled do this navigate to Regedit HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced search for a Dword named Balloontipsenabled and set it to 1 Balloon tips are way better the message boxes [font="Arial Black"]My Stuff[/font]UPnP Port Forwarding Final.GateWay InformationThe GateWay Watcher(detect speeofing)Rightclick Any file --->Hide/UnhideThe Tip WatcherA PanelShare WatcherThe Arp WatcherThe Online License Checker Link to comment Share on other sites More sharing options...
corz Posted October 12, 2007 Share Posted October 12, 2007 Erm, no. They are disabled for a REASON! And they will stay that way! And anyone who has disabled them, is probably well aware how to enable them again! Who said anything about message boxes? I'm referring to TraySetToolTip(). Check your AutoIt manual. ;o) (or nothing is foolproof to the sufficiently talented fool.. Link to comment Share on other sites More sharing options...
Ibrahim Posted October 12, 2007 Share Posted October 12, 2007 :"> [font="Arial Black"]My Stuff[/font]UPnP Port Forwarding Final.GateWay InformationThe GateWay Watcher(detect speeofing)Rightclick Any file --->Hide/UnhideThe Tip WatcherA PanelShare WatcherThe Arp WatcherThe Online License Checker Link to comment Share on other sites More sharing options...
Ibrahim Posted October 17, 2007 Share Posted October 17, 2007 Any Body figured out how to query data from active directory share Session part.It's more fast, less DOS and most of all not all machines can tolerate dos output every 1-5 seconds,So active directory query will fit better and Appropriate. [font="Arial Black"]My Stuff[/font]UPnP Port Forwarding Final.GateWay InformationThe GateWay Watcher(detect speeofing)Rightclick Any file --->Hide/UnhideThe Tip WatcherA PanelShare WatcherThe Arp WatcherThe Online License Checker Link to comment Share on other sites More sharing options...
LordSphynx Posted November 6, 2007 Share Posted November 6, 2007 Ibrahim, Could you make an option to write the sessions to a logfile ? That would come in handy ! Link to comment Share on other sites More sharing options...
Ibrahim Posted June 24, 2008 Share Posted June 24, 2008 just paste this line in the while wend loop After traytip $filepath="c:\sharewatcher.log" FileWriteLine($filePath,@HOUR&":"&@MIN&"----->"&$sSessions) [font="Arial Black"]My Stuff[/font]UPnP Port Forwarding Final.GateWay InformationThe GateWay Watcher(detect speeofing)Rightclick Any file --->Hide/UnhideThe Tip WatcherA PanelShare WatcherThe Arp WatcherThe Online License Checker Link to comment Share on other sites More sharing options...
Hellooopsforgotsendcommand Posted November 22, 2009 Share Posted November 22, 2009 Based on Ibraham's script: This is a more advanced version, with the looks to prove it. Put the attached icon.ico file in the same directory as the script. What attached icon file! there is only a script to copy and paste. Link to comment Share on other sites More sharing options...
jvanegmond Posted November 23, 2009 Author Share Posted November 23, 2009 (edited) ------- Edited March 21, 2018 by jvanegmond github.com/jvanegmond Link to comment Share on other sites More sharing options...
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