AltTab Posted November 20, 2013 Report Posted November 20, 2013 Joined to share this code that i have been using on my computer that runs uTorrent and PlexApp. Also before sharing this code there is a behavior you should know about too. If you use uTorrents Schedule feature this WebUI setting limit will not affect the limits set by the scheduler. But for me after the scheduler changes back to Full Speed at 6PM then i have a scheduled task in windows that runs this vbscript that starts at 6 and repeats for 6 hours every 5 minutes. Doing this so when i want to watch streaming videos from the Roku's Plex or Ouya's XBMC I can while still using uTorrent.on error resume next'on error goto 0'EDIT THESE VARIABLESuTorrentIP="192.168.1.2" 'THIS MUST BE CHANGED TO MATCH YOUR uTORRENT CLIENT/NAS...WHATEVER IT IS!!!!uTorrentPort="23177"uTorrentServerID="admin"uTorrentServerPW="admin"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Dim MyConnection, TheURLsComputerName = "."Set objWMIService = GetObject("winmgmts:\\" & sComputerName & "\root\cimv2")sQuery = "SELECT * FROM Win32_Process"Set objItems = objWMIService.ExecQuery(sQuery)'iterate all item(s)isPlexTranscoding = FalseFor Each objItem In objItems If UCase(objItem.Name) = "PLEXNEWTRANSCODER.EXE" Then uLimit 300,25 isPlexTranscoding = True Exit For ElseIf UCase(objItem.Name) = "PLEXTRANSCODER.EXE" Then uLimit 300,25 isPlexTranscoding = True Exit For Else isPlexTranscoding = False End If NextIf isPlexTranscoding = False Then dim objPing dim objStatus dim strComputer strComputer="192.168.1.7" 'IP Address or Name Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._ ExecQuery("select Replysize from Win32_PingStatus where address = '" & strComputer & "'") For Each objStatus in objPing If IsNull(objStatus.ReplySize) Then 'WScript.Echo "computer is offline" 'If isPlexTranscoding = False Then uLimit 0,0 Else 'WScript.Echo "computer is online" uLimit 300,25 End If Next Set objPing=Nothing Set objStatus=NothingEnd IfSub uLimit(dlrate,ulrate) TOKEN = getTOKEN TheURL="HTTP://"&uTorrentIP&":"&uTorrentPort&"/gui/?token="&TOKEN&"&action=setsetting&s=max_dl_rate&v="&dlrate&"&s=max_ul_rate&v="&ulrate Set Http = CreateObject("MSXML2.XMLHTTP") Http.Open "GET",TheURL,false Http.Send uTorrentResponse = Http.responseText Set Http = Nothing 'msgbox uTorrentResponseEnd SubFunction getTOKEN 'GO FETCH AND PARSE THE A TOKEN FROM uTorrent 'TokenURL="HTTP://"&uTorrentServerID&":"&uTorrentServerPW&"@"&uTorrentIP&":"&uTorrentPort&"/gui/token.html" TokenURL="HTTP://"&uTorrentIP&":"&uTorrentPort&"/gui/token.html" Set xml = CreateObject("Microsoft.XMLHTTP") 'xml.Open "GET", TokenURL, False xml.Open "GET", TokenURL, False, uTorrentServerID, uTorrentServerPW xml.SEND TokenPage = xml.responseText StartTag="<div id='token' style='display:none;'>" EndTag="</div>" getTOKEN = "" lArray = Split(TokenPage, StartTag) If IsArray(lArray) Then Extract = lArray(1) lArray = Split(Extract, EndTag) If IsArray(lArray) Then getTOKEN = lArray(0) Else getTOKEN = "" End If End If Set xml = NothingEnd Function
Brenex Posted August 27, 2014 Report Posted August 27, 2014 Just wanted to say thank you for this script! I didn't want to have to switch the router out at my parent's house for one that supported QoS if I didn't need to. I realized you have one computer torrenting and another computer serving plex so I saw to change both addresses in the script.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.