Jump to content

Script to connect to utorrent and change bandwidth


Recommended Posts

I've been trying to get something going that will work. I'm trying to get a script going that when I click on a game icon, it will run the script and set my utorrent to DL: 350kB/s | UL: 60kB/s. That is it.

Another script will run in the background and when the game closes it will run another script. Its simple but can't find nothing on the internet that makes it simple. I've found programs like Utspeed.exe that run with other programs etc. Everything wants to run automatically or continuously updates Utorrent based on system.

This is my problem:

I click game icon, which is a *.bat file:

@echo off

start "Title" "C:\Games\World_of_Tanks\WOTLauncher.exe"

start "Title" "C:\Users\Dexter\AppData\Local\TeamSpeak 3 Client\ts3client_win64.exe"

start "Title" "C:\WOT STOP.ahk" (This is script to change settings once game closes)

start "Title" "C:\UT.ahk" (This is my current UTlimiter russian script that kinda does what I want...)

So then WOT STOP.ahk looks like this:

SetTimer, StartScript, 1000

Sleep 10000

Send !+^i ; Sets my fan speed on video card

Send !+^i

Sleep 150000

Process, Exist, WorldOfTanks.exe

Status = %ErrorLevel%

while Status > 0

{

Sleep 60000

If (Status = 0)

{

ExitApp

}

Process, Exist, WorldOfTanks.exe

Status = %ErrorLevel%

}

Process, Close, ts3client_win64.exe

Sleep 1000

Send !+^p

Send !+^p

Sleep 1000

ExitApp

StartScript:

:)?:somehotstring::Hello, world!

Return

At the end of this script, once the game closes, I want to use the utorrent script once again to set the bandwidth back to DL: Unlimited | UP: 90kB/s (Yes, I'm to lazy to do it manually)

Link to comment
Share on other sites

Something like this but alot more simple, this was translated from Russian so if you can't read it you know why... This works but it does alot of other things I don't want it to do and I've tried to weed out the script to simplify it but I'm not that smart.

http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf-home&trurl=http%3A%2F%2Frutracker.org%2Fforum%2Fviewtopic.php%3Ft%3D3464506&lp=ru_en&btnTrUrl=Translate

Link to comment
Share on other sites

  • Developers

Correct but the posted code isn't AutoIT3 code.

Also read the forumrules before posting in case you decide going for AutoIt3 coding.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I don't understand what your saying, maybe you should read the post again.

Edit: I'm looking for a script to do this task. I'm looking for a script to connect to utorrent and change the bandwidth, I'm going to add it to this exsisting script, it can be run with a seperate program and still work in the script.

Edited by Protozoan
Link to comment
Share on other sites

It's understood you made some code in another language, but it sounds like you want someone to code your utorrent setting changes for you in AutoIT.

I believe Jos is pointing out the fact that no one is going to write code for you in AutoIT if you haven't put forth the effort to start writing it yourself.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

That is exactly what I need help with... I got this program called UT Speed Script 2.1.1 it uses Autoit and abunch of other programs like Utspeed.exe and what it does is monitors your computer to change utorrent to accomidate your bandwidth while your on the internet automaticly so you don't have to constantly adjust utorrent while you surf the net. I need help making the script using this script, it does what I need but it also does alot of stuff I don't want it to, I need to pick out the part I need, that is the link I provided which runs this script or something like this...

'[uT Limiter] Âåðñèÿ 2.1.1 | ÀÂòîð: Alcotana | E-mail: alcotana@rambler.ru | ñÀéò: http://rutracker.org/forum/viewtopic.php?t=3464506

'ÏåðÂè÷íûå íÀñòðîéêè''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

UseSettings = 2 ' - èñÏîëüçîÂÀòü íÀñòðîéêè: 0 - Âíóòðåííèå, 1 - Âíåøíèå ñòÀòè÷åñêèå, 2 - Âíåøíèå äèíÀìè÷åñêèå [0/1/2]

SettingsPath = "settings.ini" ' - íÀçÂÀíèå ini-ôÀéëÀ ñ íÀñòðîéêÀìè èëè Ïîëíûé Ïóòü ê íåìó (èä¸ò  êîìÏëåêòå) [str]

'ÂíèìÀíèå! ñëåäóþùèå íÀñòðîéêè áóäóò ÏåðåçÀÏèñÀíû íÀñòðîéêÀìè, íÀéäåííûìè Âî Âíåøíåì ôÀéëå, åñëè UseSettings = 1!

'îñíîÂíûå íÀñòðîéêè''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

MonitorProcess = "WorldOfTanks.exe" ' - íÀçÂÀíèå îòñëåæèÂÀåìîãî ÏðîöåññÀ (ìîæíî óêÀçÀòü íåñêîëüêî ÷åðåç "|") [str]

MonitorWindow = "Opera|Mozilla Firefox" ' - ÷Àñòü íÀçÂÀíèÿ îòñëåæèÂÀåìîãî îêíÀ (ìîæíî óêÀçÀòü íåñêîëüêî ÷åðåç "|") [str]

MonitorHost = "" ' - ÷Àñòü íÀçÂÀíèÿ èëè Ïîëíûé IP îòñëåæèÂÀåìîãî õîñòÀ (ìîæíî óêÀçÀòü íåñêîëüêî ÷åðåç "|") [str]

Mode = 0 ' - ðåæèì ðÀáîòû ñêðèÏòÀ: 0 - ëèìèòû, 1 - ðÀñÏèñÀíèå, 2 - ipfilter [0/1/2]

DownloadDefault = 0 ' - íîðìÀëüíÀÿ ñêîðîñòü ñêÀ÷êè [êá/c]

UploadDefault = 90 ' - íîðìÀëüíÀÿ ñêîðîñòü îòäÀ÷è [êá/c]

DownloadLimit = 350 ' - îãðÀíè÷åíèå ñêîðîñòè ñêÀ÷êè Ïðè îáíÀðóæ. ÏðîöåññîÂ, îêîí èëè õîñòî [êá/c]

UploadLimit = 60 ' - îãðÀíè÷åíèå ñêîðîñòè îòäÀ÷è Ïðè îáíÀðóæ. ÏðîöåññîÂ, îêîí èëè õîñòî [êá/c]

IdleTime = 0 ' - Âðåìÿ Ïðîñòîÿ äî ÷Àñòè÷íîãî ÂîññòÀíîÂë. ñêîðîñòè [ñåê.]

IdleDownSpeed = 0 ' - ñêîðîñòü ñêÀ÷êè Âî Âðåìÿ Ïðîñòîÿ [êá/c]

IdleUpSpeed = 0 ' - ñêîðîñòü îòäÀ÷è Âî Âðåìÿ Ïðîñòîÿ [êá/c]

AwayTime = 0 ' - Âðåìÿ îòñóòñòÂèÿ äî Ïîëíîãî ÂîññòÀíîÂë. ñêîðîñòè [ñåê.]

AwayDownSpeed = 0 ' - ñêîðîñòü ñêÀ÷êè Âî Âðåìÿ îòñóòñòÂèÿ [êá/c]

AwayUpSpeed = 0 ' - ñêîðîñòü îòäÀ÷è Âî Âðåìÿ îòñóòñòÂèÿ [êá/c]

TerminationDownSpeed = 0 ' - ìÀêñèìÀëüíÀÿ îáùÀÿ ñêîðîñòü ñêÀ÷êè, Ïîñëå êîòîðîé Âêëþ÷Àþòñÿ ëèìèòû (òîëüêî äëÿ ëîêÀëüíûõ êîìÏîÂ!) [êá/c]

TerminationUpSpeed = 0 ' - ìÀêñèìÀëüíÀÿ îáùÀÿ ñêîðîñòü îòäÀ÷è, Ïîñëå êîòîðîé Âêëþ÷Àþòñÿ ëèìèòû (òîëüêî äëÿ ëîêÀëüíûõ êîìÏîÂ!) [êá/c]

ShutdownSpeed = 0 ' - ìèíèìÀëüíÀÿ îáùÀÿ ñêîðîñòü ñêÀ÷êè, Ïîñëå êîòîðîé Ïðîèñõîäèò Âûêëþ÷åíèå êîìÏÀ [êá/c]

'îñîáûå íÀñòðîéêè''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

SystemRun = 0 ' - çÀÏóñêÀòü ñêðèÏò: 0 - ÀÂòîíîìíî, 1 -  ñèñòåìå [0/1]

InstallPath = "" ' - Ïóòü ê ÏÀÏêå óñòÀíîÂêè ÏÀêåòÀ (îñòÀÂüòå Ïóñòûì, åñëè ýòÀ æå ÏÀÏêÀ) [str]

uTorrentProcess = "utorrent.exe" ' - íÀçÂÀíèå ÏðîöåññÀ ÏðîãðÀììû uTorrent [str]

uTSpeedProcess = "utspeed.exe" ' - íÀçÂÀíèå ÏðîöåññÀ ÏðîãðÀììû uTSpeed (èä¸ò  êîìÏëåêòå) [str]

uTSpeedSettings = "utspeed.ini" ' - íÀçÂÀíèå ini-ôÀéëÀ ñ íÀñòðîéêÀìè Ïîäêëþ÷åíèÿ (äëÿ ÏðîãðÀììû uTSpeed, èä¸ò  êîìÏëåêòå) [str]

WScriptName = "wscript.exe" ' - íÀçÂÀíèå ÏðîãðÀììû "wscript.exe" (äëÿ ÀÂòîíîìíîãî çÀÏóñêÀ, èä¸ò  êîìÏëåêòå) [str]

AutoItXName = "AutoItX3.dll" ' - íÀçÂÀíèå AutoItX áèáëèîòåêè (èä¸ò  êîìÏëåêòå) [str]

FileNameOn = "UT Limiter [on].vbs" ' - èìÿ ôÀéëÀ Ïðè Âêëþ÷åííîì ñêðèÏòå [str]

FileNameOff = "UT Limiter [off].vbs" ' - èìÿ ôÀéëÀ Ïðè Âûêëþ÷åííîì ñêðèÏòå [str]

HostUseAuth = 0 ' - èñÏîëüçîÂÀòü ëîãèí è ÏÀðîëü äëÿ Ïîäêëþ÷åíèÿ ê óäÀë¸ííîìó êîìÏüþòåðó ñ óñòÀíîÂëåííûì uTorrent [0/1]

HostUsername = "" ' - ó÷¸òíÀÿ çÀÏèñü ÀäìèíèñòðÀòîðÀ óäÀë¸ííîãî êîìÏüþòåðÀ ñ óñòÀíîÂëåííûì uTorrent [str]

HostPassword = "" ' - ÏÀðîëü ÀäìèíèñòðÀòîðÀ óäÀë¸ííîãî êîìÏüþòåðÀ ñ óñòÀíîÂëåííûì uTorrent (îñòÀÂüòå Ïóñòûì, åñëè õîòèòå ÂÂîäèòü ÏÀðîëü Ïðè çÀÏóñêå) [str]

'äîÏîëíèòåëüíûå íÀñòðîéêè''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

LoopDelay = 1000 ' - çÀìåäëåíèå ñêîðîñòè äåòåêòèðîÂÀíèÿ ÏðîöåññîÂ, îêîí, õîñòîÂ, ôÀéëî (÷åì Âûøå, òåì ìåíüøå íÀãðóçêÀ íÀ Ïðîöåññîð, íî ìåäëåííå ðåÀêöèÿ) [ìñ]

MouseDelay = 500 ' - çÀìåäëåíèå ñêîðîñòè äåòåêòèðîÂÀíèÿ äÂèæåíèÿ ìûøè (÷åì Âûøå, òåì ìåíüøå íÀãðóçêÀ íÀ Ïðîöåññîð, íî ìåäëåííå ðåÀêöèÿ) [ìñ]

pingTimeout = 1500 ' - ìÀêñèìÀëüíîå Âðåìÿ îæèäÀíèÿ îòÂåòÀ îò õîñòÀ [ìñ]

TitleMatchMode = 2 ' - ðåæèì ñîÂÏÀäåíèÿ íÀçÂÀíèÿ îêíÀ: 1 - òîëüêî ñ íÀ÷ÀëÀ, 2 -  ëþáîì ìåñòå, 3 - Ïîëíîñòüþ [1/2/3]

WinSearchChildren = 0 ' - ðåæèì ÏîèñêÀ îêîí: 0 - òîëüêî  ðîäèòåëüñêèõ îêíÀõ, 1 -  ðîäèòåëüñêèõ è äî÷åðíèõ îêíÀõ [0/1]

NetworkInterface = "WAN [PPP_SLIP] Interface" ' - íÀçÂÀíèå ÀêòèÂíîãî ñåòåÂîãî èíòåðôåéñÀ (ÂûÏîëíèòü "ipconfig /all", ñìîòðåòü ñòðîêó "îÏèñÀíèå", ÂûÏîëíèòü "wmic Path Win32_PerfFormattedData_Tcpip_NetworkInterface Get Name", ñêîÏèðîÂÀòü íóæíûé) [str]

TerminationDelay = 2 ' - èíòåðÂÀë äåòåêòèðîÂÀíèÿ ñðåäíåé çÀãðóçêè êÀíÀëÀ äëÿ Âêëþ÷åíèÿ ëèìèòî [ñ]

ShutdownDelay = 2 ' - èíòåðÂÀë äåòåêòèðîÂÀíèÿ ñðåäíåé çÀãðóçêè êÀíÀëÀ äëÿ Âûêëþ÷åíèÿ êîìÏÀ [ñ]

ShutdownType = 1 ' - òèÏ Âûêëþ÷åíèÿ êîìÏÀ: 0 - Logoff, 1 - Shutdown, 2 - Reboot, 8 - Power off (åñëè äîñòóÏíî) [0/1/2/8]

ShutdownForced = 0 ' - èñÏîëüçîÂÀòü ñèëîÂîå Âûêëþ÷åíèå êîìÏÀ ñ íåìåäëåííîé îñòÀíîÂêîé Âñåõ ñåðÂèñî [0/1]

'èíèöèÀëèçÀöèÿ'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Set WShell = CreateObject("wscript.shell")

Set Fso = CreateObject("Scripting.FileSystemObject")

Set ScriptFile = Fso.GetFile(WScript.ScriptFullName)

Set WMIInterface = Nothing

Set WMILocal = Nothing

Set WMIQuery = Nothing

SettingsArray = Array("MonitorProcess", "MonitorWindow", "MonitorHost", "Mode", "DownloadDefault", "UploadDefault", "DownloadLimit", "UploadLimit", "IdleTime", "IdleDownSpeed", "IdleUpSpeed", "AwayTime", "AwayDownSpeed", "AwayUpSpeed", "TerminationDownSpeed", "TerminationUpSpeed", "ShutdownSpeed", "SystemRun", "InstallPath", "uTorrentProcess", "uTSpeedProcess", "uTSpeedSettings", "WScriptName", "AutoItXName", "FileNameOn", "FileNameOff", "HostUseAuth", "HostUsername", "HostPassword", "LoopDelay", "MouseDelay", "pingTimeout", "TitleMatchMode", "WinSearchChildren", "NetworkInterface", "TerminationDelay", "ShutdownDelay", "ShutdownType", "ShutdownForced")

SpecialSettingsArray = Array("SystemRun", "InstallPath", "uTorrentProcess", "uTSpeedProcess", "uTSpeedSettings", "WScriptName", "AutoItXName", "FileNameOn", "FileNameOff", "HostUseAuth", "HostUsername", "HostPassword")

ExtraSettingsArray = Array("LoopDelay", "MouseDelay", "pingTimeout", "TitleMatchMode", "WinSearchChildren", "NetworkInterface", "TerminationDelay", "ShutdownDelay", "ShutdownType", "ShutdownForced")

SpecialSettings = join(SpecialSettingsArray, "|")

ExtraSettings = join(ExtraSettingsArray, "|")

HostName = ""

IsLimited = 2

SettingsGot = 0

SettingsTime = 0

TerminationTime = 0

ShutdownTime = 0

BytesReceivedPerSec = 0

BytesSentPerSec = 0

TerminationActive = false

NetworkInterfaceOption = ""

Dim MonitorProcessArray, MonitorWindowArray, MonitorHostArray, MonitorOptions, oAutoItOptions, ModeOption

GetSettings

CheckFileNameOn

CheckInstallPath

GetHostName

CheckUTSpeedFile

CheckWScriptFile

CheckStandAlone

CheckFileNameOff

On Error Resume Next

Set oAutoIt = CreateObject("AutoItX3.Control")

If Err Then

If RegisterAutoItX Then

Set oAutoIt = CreateObject("AutoItX3.Control")

Else

MsgBox "íå óäÀëîñü çÀðåãèñòðèðîÂÀòü áèáëèîòåêó " & AutoItXName & "! ÏîÏðîáóéòå ñäåëÀòü ýòî Âðó÷íóþ. ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

End If

End If

On Error Resume Next

Set Locator = CreateObject("WbemScripting.SWbemLocator")

If HostUseAuth = 0 Then

Set WMIHost = Locator.ConnectServer(HostName, "rootcimv2")

WMIHost.Security_.ImpersonationLevel = 3

Else

If HostPassword = "" Then

PromptedPassword = InputBox("ÂÂåäèòå ÏÀðîëü äëÿ " & HostUsername, "ÂÂîä ÏÀðîëÿ - UT Limiter")

If PromptedPassword = "" Then

ExitScript

Else

Set WMIHost = Locator.ConnectServer(HostName, "rootcimv2", HostUsername, PromptedPassword)

WMIHost.Security_.ImpersonationLevel = 3

End If

Else

Set WMIHost = Locator.ConnectServer(HostName, "rootcimv2", HostUsername, HostPassword)

WMIHost.Security_.ImpersonationLevel = 3

End If

End If

If Err Then

On Error GoTo 0

On Error Resume Next

Set WMIHost = Locator.ConnectServer(HostName, "rootcimv2")

WMIHost.Security_.ImpersonationLevel = 3

If Err Then

MsgBox "íå óäÀëîñü Ïîäêëþ÷èòüñÿ ê """ & HostName & """! ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

Else

MsgBox "óñòÀíîÂëåíî Ïîäêëþ÷åíèå ê """ & HostName & """ îò èìåíè òåêóùåé ó÷åòíîé çÀÏèñè. ", vbInformation + vbOKOnly, "óÂåäîìëåíèå - UT Limiter"

End If

End If

Set WMILocal = GetObject("winmgmts:{impersonationLevel=impersonate}.rootcimv2")

If Err Then

MsgBox "íå óäÀëîñü ñîçäÀòü WMI îáúåêò äëÿ òåêóùåãî êîìÏüþòåðÀ! ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

End If

On Error GoTo 0

'ìîíèòîðèíã''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Do

CheckScriptExists

GetSettings

CheckSettings

CheckTermination

CheckShutdown

If ProcessExists or WindowActive or HostActive or TerminationActive Then

SetLimitsTrue

Else

SetLimitsFalse

End If

PrevMpos = 0

Do While (ProcessExists or WindowActive) and uTorrentProcessExists and Not HostActive and Not TerminationActive

CheckScriptExists

GetSettings

CheckSettings

CheckTermination

CheckShutdown

SetLimitsTrue

WScript.Sleep LoopDelay

Loop

WScript.Sleep LoopDelay

Loop

'ôóíêöèè'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Function uTorrentProcessExists

Set WMIQuery = WMILocal.ExecQuery("Select * from win32_process where Name = '" & uTorrentProcess & "'")

If WMIQuery.Count <> 0 Then

uTorrentProcessExists = true

Exit Function

End If

uTorrentProcessExists = false

End Function

Function ProcessExists

If Not IsEmpty(MonitorProcessArray) Then

For Each Item In MonitorProcessArray

If oAutoIt.ProcessExists(Item) Then

ProcessExists = true

Exit Function

End If

Next

End If

ProcessExists = false

End Function

Function WindowActive

If Not IsEmpty(MonitorWindowArray) Then

For Each Item In MonitorWindowArray

If oAutoIt.WinActive(Item) Then

WindowActive = true

Exit Function

End If

Next

End If

WindowActive = false

End Function

Function HostActive

If Not IsEmpty(MonitorHostArray) Then

For Each Item In MonitorHostArray

If PingHost(Item) Then

HostActive = true

Exit Function

End If

Next

End If

HostActive = false

End Function

Function PingHost(Host)

If Not IsEmpty(Host) Then

pingCommand = "ping -n 1 -w " & pingTimeout & " " & Host

ReturnCode = WShell.Run(pingCommand, 0, true)

If ReturnCode = 0 Then

PingHost = true

Exit Function

End If

End If

PingHost = false

End Function

Function CheckShutdown

CheckNetworkInterface

If (ShutdownTime = 0 or (Timer - ShutdownTime) > ShutdownDelay) and ShutdownSpeed > 0 and Not (WMIInterface Is Nothing) Then

WMIInterface.Refresh_

BytesReceivedPerSec = WMIInterface.BytesReceivedPerSec

If BytesReceivedPerSec <> 0 and ShutdownTime <> 0 Then

DownSpeed = round(BytesReceivedPerSec / 1024)

If DownSpeed < ShutdownSpeed and ShutdownSpeed <> 0 Then

Set OperatingSystems = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}.rootcimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")

For Each objOperatingSystem in OperatingSystems

objOperatingSystem.Win32Shutdown(ShutdownType + ShutdownForced)

Next

CheckShutdown = true

ExitScript

Else

CheckShutdown = false

End If

End If

ShutdownTime = Timer

Else

CheckShutdown = false

End If

End Function

Function CheckTermination

CheckNetworkInterface

If (TerminationTime = 0 or (Timer - TerminationTime) > TerminationDelay) and (TerminationDownSpeed > 0 or TerminationUpSpeed > 0) and Not (WMIInterface Is Nothing) Then

WMIInterface.Refresh_

BytesReceivedPerSec = WMIInterface.BytesReceivedPerSec

BytesSentPersec = WMIInterface.BytesSentPersec

If (BytesReceivedPerSec <> 0 or BytesSentPersec <> 0) and TerminationTime <> 0 Then

DownSpeed = round(BytesReceivedPerSec / 1024)

UpSpeed = round(BytesSentPersec / 1024)

If (DownSpeed > TerminationDownSpeed and TerminationDownSpeed <> 0) or (UpSpeed > TerminationUpSpeed and TerminationUpSpeed <> 0) Then

TerminationActive = true

Else

TerminationActive = false

End If

End If

TerminationTime = Timer

Else

TerminationActive = false

End If

End Function

Function CheckNetworkInterface

If NetworkInterfaceOption <> NetworkInterface Then

If Not IsEmpty(NetworkInterface) and (TerminationDownSpeed <> 0 or TerminationUpSpeed <> 0 or ShutdownSpeed <> 0) Then

On Error Resume Next

Set WMIQuery = WMILocal.ExecQuery("Select * from Win32_PerfFormattedData_Tcpip_NetworkInterface where Name = '" & NetworkInterface & "'")

If Err or WMIQuery.Count = 0 Then

MsgBox "ñåòåÂîé èíòåðôåéñ ñ èìåíåì """ & NetworkInterface & """ íå íÀéäåí! ñêðèÏò Ïðîäîëæèò ðÀáîòó... ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

Set WMIInterface = Nothing

Else

Set WMIInterface = WMILocal.Get("Win32_PerfFormattedData_Tcpip_NetworkInterface.Name=""" & NetworkInterface & """")

End If

NetworkInterfaceOption = NetworkInterface

On Error Goto 0

Else

Set WMIInterface = Nothing

End If

End If

If IsObject(WMIInterface) Then

CheckNetworkInterface = True

Else

CheckNetworkInterface = False

End If

End Function

Function SetLimitsTrue

If IsLimited <> 1 and Mode = 0 and uTorrentProcessExists Then

WShell.Run """" & InstallPath & uTSpeedProcess & """ /max_dl_rate " & DownloadLimit & " /max_ul_rate " & UploadLimit, 0, true

IsLimited = 1

End If

If IsLimited <> 1 and Mode = 1 and uTorrentProcessExists Then

WShell.Run """" & InstallPath & uTSpeedProcess & """ /sched_enable 1", 0, true

IsLimited = 1

End If

If IsLimited <> 1 and Mode = 2 and uTorrentProcessExists Then

WShell.Run """" & InstallPath & uTSpeedProcess & """ /ipfilter.enable 1", 0, true

IsLimited = 1

End If

End Function

Function SetLimitsFalse

If IsLimited <> 0 and Mode = 0 and uTorrentProcessExists Then

WShell.Run """" & InstallPath & uTSpeedProcess & """ /max_dl_rate " & DownloadDefault & " /max_ul_rate " & UploadDefault, 0, true

IsLimited = 0

End If

If IsLimited <> 0 and Mode = 1 and uTorrentProcessExists Then

WShell.Run """" & InstallPath & uTSpeedProcess & """ /sched_enable 0", 0, true

IsLimited = 0

End If

If IsLimited <> 0 and Mode = 2 and uTorrentProcessExists Then

WShell.Run """" & InstallPath & uTSpeedProcess & """ /ipfilter.enable 0", 0, true

IsLimited = 0

End If

End Function

Function SetIdleLimits

End Function

Function SetAwayLimits

End Function

Function CheckStandAlone

If SystemRun = 0 and WScript.Path <> Left(InstallPath, Len(InstallPath) - 1) Then

WShell.Run """" & InstallPath & WScriptName & """ """ & WScript.ScriptFullName & """", 0, false

CleanUp

WScript.Quit

End If

End Function

Function RegisterAutoItX

SystemFolder = WShell.ExpandEnvironmentStrings("%SYSTEMROOT%") & "system32"

On Error Resume Next

Fso.CopyFile InstallPath & AutoItXName, SystemFolder & AutoItXName, true

On Error GoTo 0

regsvr32Command = "regsvr32.exe /s ""%SystemRoot%system32" & AutoItXName & """"

ReturnCode = WShell.Run(regsvr32Command, 0, true)

If ReturnCode = 0 Then

RegisterAutoItX = true

Exit Function

End If

RegisterAutoItX = false

End Function

Function CheckFileNameOn

If ScriptFile.Name = FileNameOn Then

ExitScript

End If

End Function

Function CheckFileNameOff

If ScriptFile.Name <> FileNameOn Then

On Error Resume Next

ScriptFile.Name = FileNameOn

If Err Then

MsgBox "íå óäÀ¸òñÿ ÏåðåèìåíîÂÀòü ôÀéë ñêðèÏòÀ! óäÀëèòå ôÀéë """ & FileNameOn & """! ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

Else

On Error GoTo 0

End If

End If

End Function

Function CheckInstallPath

If InstallPath = "" Then

InstallPath = GetScriptPath

Else

If Right(InstallPath, 1) <> "" Then

InstallPath = InstallPath & ""

End If

End If

If Not Fso.FolderExists(InstallPath) Then

MsgBox "óêÀçÀííîãî Ïóòè """ & InstallPath & """ íå ñóùåñòÂóåò! ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

End If

End Function

Function CheckWScriptFile

If SystemRun = 0 and Not Fso.FileExists(InstallPath & WScriptName) Then

MsgBox "ôÀéë """ & WScriptName & """ íå íÀéäåí! ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

End If

End Function

Function CheckUTSpeedFile

If Not Fso.FileExists(InstallPath & uTSpeedProcess) Then

MsgBox "ôÀéë """ & uTSpeedProcess & """ íå íÀéäåí! ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

End If

End Function

Function CheckUTSpeedSettingsFile

If Not Fso.FileExists(InstallPath & uTSpeedSettings) Then

MsgBox "ôÀéë """ & uTSpeedSettings & """ íå íÀéäåí! ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

End If

End Function

Function CheckScriptExists

If Not Fso.FileExists(InstallPath & FileNameOn) Then

SetLimitsFalse

ExitScript

End If

End Function

Function CheckSettingsPath

If Not Fso.FileExists(SettingsPath) Then

If Not Fso.FileExists(GetScriptPath & SettingsPath) Then

MsgBox "ôÀéë """ & SettingsPath & """ íå íÀéäåí! ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

Else

SettingsPath = GetScriptPath & SettingsPath

End If

End If

End Function

Function CheckSettings

If MonitorOptions <> MonitorProcess & MonitorWindow & MonitorHost Then

MonitorProcessArray = split(MonitorProcess, "|")

MonitorWindowArray = split(MonitorWindow, "|")

MonitorHostArray = split(MonitorHost, "|")

MonitorOptions = MonitorProcess & MonitorWindow & MonitorHost

End If

If oAutoItOptions <> TitleMatchMode & WinSearchChildren Then

oAutoIt.Opt "WinTitleMatchMode", TitleMatchMode

oAutoIt.Opt "WinSearchChildren", WinSearchChildren

oAutoItOptions = TitleMatchMode & WinSearchChildren

End If

If ModeOption <> Mode Then

ModeBackup = Mode

Mode = ModeOption

SetLimitsFalse

Mode = ModeBackup

ModeOption = Mode

End If

End Function

Function GetSettings

If (UseSettings = 1 and SettingsGot = 0) or UseSettings = 2 Then

CheckSettingsPath

On Error Resume Next

Settings = Fso.OpenTextFile(SettingsPath, 1).ReadAll

For Each SettingName In SettingsArray

SettingValue = GetSetting(Settings, SettingName)

If SettingValue <> false Then

If Not IsNumeric(SettingValue) Then

SettingValue = """" & SettingValue & """"

End If

If Not Eval(SettingName & " = " & SettingValue) and Not (InStr(1, SpecialSettings, SettingName, vbTextCompare) <> 0 and SettingsGot = 1) Then

Execute(SettingName & " = " & SettingValue)

If InStr(1, ExtraSettings, SettingName, vbTextCompare) = 0 Then

IsLimited = 2

End If

End If

End If

Next

If Err Then

MsgBox "ÂîçíèêëÀ îøèáêÀ Ïðè ÷òåíèè íÀñòðîåê èç ini-ôÀéëÀ! ÏðîÂåðüòå ôÀéë """ & SettingsPath & """ è ÏåðåçÀÏóñòèòå ñêðèÏò. ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

Else

On Error GoTo 0

End If

SettingsGot = 1

End If

End Function

Function GetHostName

CheckUTSpeedSettingsFile

On Error Resume Next

Settings = Fso.OpenTextFile(InstallPath & uTSpeedSettings).ReadAll

SettingValue = GetSetting(Settings, "ip")

If SettingValue <> false Then

If PingHost(SettingValue) Then

If Not IsNumeric(SettingValue) Then

SettingValue = """" & SettingValue & """"

End If

Execute("HostName = " & SettingValue)

Else

MsgBox "óêÀçÀííûé  íÀñòðîéêÀõ IP-Àäðåñ íåäîñòóÏåí! ÏðîÂåðüòå ôÀéë """ & uTSpeedSettings & """ è ÏåðåçÀÏóñòèòå ñêðèÏò. ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

End If

End If

If Err Then

MsgBox "ÂîçíèêëÀ îøèáêÀ Ïðè ÷òåíèè íÀñòðîåê èç ini-ôÀéëÀ! ÏðîÂåðüòå ôÀéë """ & uTSpeedSettings & """ è ÏåðåçÀÏóñòèòå ñêðèÏò. ", vbInformation + vbOKOnly, "îøèáêÀ - UT Limiter"

ExitScript

Else

On Error GoTo 0

End If

End Function

Function GetSetting(Settings, SettingName)

StartPos = InStr(1, Settings, vbCrLf & SettingName & "=", vbTextCompare)

If StartPos > 0 Then

StartPos = StartPos + Len(vbCrLf & SettingName & "=")

EndPos = InStr(StartPos, Settings, vbCrLf, vbTextCompare)

If EndPos = 0 Then

EndPos = Len(Settings) + 1

End If

SettingValue = Mid(Settings, StartPos, EndPos - StartPos)

GetSetting = SettingValue

Else

GetSetting = false

End If

End Function

Function GetScriptPath

GetScriptPath = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - Len(WScript.ScriptName))

End Function

Function CleanUp

Set WShell = Nothing

Set Fso = Nothing

Set ScriptFile = Nothing

Set oAutoIt = Nothing

Set Locator = Nothing

Set WMIHost = Nothing

Set WMILocal = Nothing

Set WMIQuery = Nothing

Set WMIInterface = Nothing

Set OperatingSystems = Nothing

Set OperatingSystems = Nothing

End Function

Function ExitScript

On Error Resume Next

ScriptFile.Name = FileNameOff

CleanUp

WScript.Quit

End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Link to comment
Share on other sites

I wonder if people get "Autoitscript" mixed up with a general meaning as opposed to the actual "AutoIT3" application?

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

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...