meYasuo Posted October 2, 2008 Share Posted October 2, 2008 hi, i am just trying to create a script which gives a TrayTip Every 9min after net connect. and after clicking on the TrayTip it shows the properties of net connection (where it shows duration of net connect). i have read the help file for ping but i could not understand how to use it as i want. it is just for bandwidth information. anyone please help me. My Mode: Link to comment Share on other sites More sharing options...
meYasuo Posted October 2, 2008 Author Share Posted October 2, 2008 i also want to know about how to connect to internet. i can disconnect with a dos command rasdial.exe /disconnect but dont know how to connect. thanxx My Mode: Link to comment Share on other sites More sharing options...
meYasuo Posted October 2, 2008 Author Share Posted October 2, 2008 anyone please help because i need it urgently My Mode: Link to comment Share on other sites More sharing options...
rasim Posted October 3, 2008 Share Posted October 3, 2008 meYasuoTry this:expandcollapse popup; $iFlag: ; 1 - The number of bytes transmitted through this connection or link. ; 2 - The number of bytes received through this connection or link. ; 3 - Total ; 4 - The amount of time, in milliseconds, that the connection or link has been connected. $stat = _RASConStat(4) MsgBox(0, "Connect Statistics", _ StringFormat("Connection duration:\n\nIn milliseconds: %s\nIn seconds: %.2f\nIn minutes: %.2f", $stat, $stat / 1000, ($stat / 1000) / 60)) Func _RASConStat($sFlags = 1) Local Const $MAX_PATH = 260 Local Const $RAS_MaxDeviceType = 16 Local Const $RAS_MaxEntryName = 256 Local Const $RAS_MaxDeviceName = 128 $tRASCONN = DllStructCreate("dword dwSize;hwnd hRasConn;char szEntryName[" & $RAS_MaxEntryName + 1 & "];" & _ "char szDeviceType[" & $RAS_MaxDeviceType + 1 & "];" & _ "char szDeviceName[" & $RAS_MaxDeviceName + 1 & "];" & _ "char szPhonebook[" & $MAX_PATH & "];" & _ "dword dwSubEntry;byte guidEntry[16];dword dwFlags;byte luid[8]") $tRAS_STATS = DllStructCreate("dword dwSize;dword dwBytesXmited;dword dwBytesRcved;dword dwFramesXmited;" & _ "dword dwFramesRcved;dword dwCrcErr;dword dwTimeoutErr;dword dwAlignmentErr;" & _ "dword dwHardwareOverrunErr;dword dwFramingErr;dword dwBufferOverrunErr;" & _ "dword dwCompressionRatioIn;dword dwCompressionRatioOut;dword dwBps;dword dwConnectDuration") $iCntByte = DllStructCreate("dword") $iCntConn = DllStructCreate("dword") DllStructSetData($iCntByte, 1, DllStructGetSize($tRASCONN)) DllStructSetData($tRASCONN, "dwSize", DllStructGetSize($tRASCONN)) DllStructSetData($tRAS_STATS, "dwSize", DllStructGetSize($tRAS_STATS)) $aRet = DllCall("rasapi32.dll", "int", "RasEnumConnections", _ "ptr", DllStructGetPtr($tRASCONN), _ "ptr", DllStructGetPtr($iCntByte), _ "ptr", DllStructGetPtr($iCntConn)) If $aRet[0] Then Return SetError(2, $aRet[0], -1) If DllStructGetData($iCntConn,1) < 1 Then Return SetError(1, 0, 0) ;Error: not opened connections $aRet = DllCall("rasapi32.dll", "int", "RasGetConnectionStatistics", _ "hwnd", DllStructGetData($tRASCONN, "hRasConn"), _ "ptr", DllStructGetPtr($tRAS_STATS)) If $aRet[0] Then Return SetError(3, $aRet[0], -1) Local $iResult = 0 Switch $sFlags Case 1 $iResult = DllStructGetData($tRAS_STATS, "dwBytesXmited") Case 2 $iResult = DllStructGetData($tRAS_STATS, "dwBytesRcved") Case 3 $iResult = DllStructGetData($tRAS_STATS, "dwBytesXmited") + DllStructGetData($tRAS_STATS, "dwBytesRcved") Case 4 $iResult = DllStructGetData($tRAS_STATS, "dwConnectDuration") EndSwitch Return $iResult EndFunc ; ==> _RASConStat Link to comment Share on other sites More sharing options...
meYasuo Posted October 3, 2008 Author Share Posted October 3, 2008 you code is awesome!!!but can you tell me how will i show TrayTip() when 9mins are passed?and on clicking the Tray Tip it will give the messagebox() with net connection statics?Thanks a lot for your code, i was really in search of it and tried myself to create something similar but i am not genius as you and i am new user of autoit.Thanks for you help! My Mode: Link to comment Share on other sites More sharing options...
meYasuo Posted October 3, 2008 Author Share Posted October 3, 2008 you code is awesome!!!but can you tell me how will i show TrayTip() when 9mins are passed?and on clicking the Tray Tip it will give the messagebox() with net connection statics?Thanks a lot for your code, i was really in search of it and tried myself to create something similar but i am not genius as you and i am new user of autoit.Thanks for you help! My Mode: Link to comment Share on other sites More sharing options...
meYasuo Posted October 3, 2008 Author Share Posted October 3, 2008 (it's a Dump) My Mode: Link to comment Share on other sites More sharing options...
anixon Posted October 4, 2008 Share Posted October 4, 2008 (it's a Dump) This is not exactly what you want but it is an example of working with time: ;//Wait 2 Minutes if Skype launched by Windows Startup [Cold or Warm Boot]: If Not ProcessExists("Skype.exe") Then $StartTicks = _TimeToTicks(@HOUR, @MIN, @SEC) $EndTicks = $StartTicks + 2 * 60 * 1000 While 1 _MessageAndLog($MessageDisplay, $MessageDelay, $sSLogDirM, $s_LogFileID, 0, 1, " Waiting for Skype TO START") If ProcessExists("Skype.exe") Or _TimeToTicks(@HOUR, @MIN, @SEC) >= $EndTicks Then $EndTicks = 0 ExitLoop EndIf WEnd EndIf This is some Tray Code ;//Switch sSentry Tray Icon to No Blink and Set Tool Tip [Default tray menu items (Script Paused/Exit) will not be shown]. Opt("TrayMenuMode", 1) ;//No Blink the Tray Icon to show that sSentry is Not Monitoring TraySetState(8) ;//Set Tool Tip TraySetToolTip("sSentry Startup") $sSTrayExit = TrayCreateItem("sS_Exit Alt+End") TraySetState() If $msg = $sSTrayExit Then If MsgBox(262180, $Title, " CLOSE sSentry ") = 6 Then ;Close sSentry OK or Cancel _ISExit() EndIf EndIf Ant.. Link to comment Share on other sites More sharing options...
kjcdude Posted November 8, 2008 Share Posted November 8, 2008 _RASConStat doesn't seem to be working on my comp How would i go about specifying which connection to pull data from? 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