Jump to content
Sign in to follow this  
reber

help for ip check script

Recommended Posts

reber

hi. i finally finish my script (thanks zenda) its run quite well. but its only for one ip. how can i modify for several (2 ip at least) ip. can i run 2 aplications but i use remote pc for torrent download and i make script for controlling utorrent. at one ip, works well. but if i run 2 aplication, utorrent sucks. :) please help, im new at autoit but learn fastly :) (please forgive my bad english)

standart script:

#include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode", 1)

$aboutitem = TrayCreateItem("Hakkında...")
$exititem = TrayCreateItem("Çıkış")

Sleep(1000)
$ip = Ping("192.168.1.1",500)
If $ip Then
    TraySetIcon(@WorkingDir & "\media\on.ico")
   SoundPlay(@WorkingDir & "\media\alert.wav", 1)
   TrayTip("Uzak Kullanıcı Aktif", "uzak kullanıcı bilgisayarı kullanmakta", 10, 1)
   IniWrite(@WorkingDir & "\media\settings.ini", "user status", "key", "1")


Else
TraySetIcon(@WorkingDir & "\media\off.ico")
IniWrite(@WorkingDir & "\media\settings.ini", "user status", "key", "0")


EndIf
Sleep(1000)




Global $start_time = TimerInit()
$ini = IniRead(@WorkingDir & "\media\settings.ini", "user status", "key", "NotFound")


TraySetState()

While 1
 $msg = TrayGetMsg()
 Select
   Case $msg = $aboutitem
       MsgBox(64, "Hakkında:", "Gültekin GÖK copyleft 2009 for everyone")
   Case $msg = $exititem
       ExitLoop
 EndSelect
 
 If TimerDiff($start_time) > 6000 Then 
   MyPing()
   $start_time = TimerInit()
 EndIf
WEnd


Func MyPing()
 $var = Ping("192.168.1.1",500)

 If $var > 0 Then
   $ini = IniRead(@WorkingDir & "\media\settings.ini", "user status", "key", "NotFound")
sleep(10)
  If $ini = 0 Then
      TraySetIcon(@WorkingDir & "\media\on.ico")
   SoundPlay(@WorkingDir & "\media\alert.wav", 1)
   TrayTip("Uzak Kullanıcı Aktif", "uzak kullanıcı bilgisayarı kullanmakta", 10, 1)
   IniWrite(@WorkingDir & "\media\settings.ini", "user status", "key", "1")
   Else
       IniWrite(@WorkingDir & "\media\settings.ini", "user status", "key", "1")
       TraySetIcon(@WorkingDir & "\media\on.ico")
    EndIf

 Else
   TraySetIcon(@WorkingDir & "\media\off.ico")
   IniWrite(@WorkingDir & "\media\settings.ini", "user status", "key", "0")
 EndIf
EndFunc

-----

for my remote download pc

#include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode", 1)

$aboutitem = TrayCreateItem("Hakkında...")
$exititem = TrayCreateItem("Çıkış")

Sleep(1000)
$ip = Ping("192.168.1.1",500)
If $ip Then
    TraySetIcon(@WorkingDir & "\media\on.ico")
    sleep(100)
         Run("C:\Program Files\uTorrent\uTorrent.exe")
sleep(100)
WinWaitActive("µTorrent 1.8.4")
sleep(100)
Send("!o")
sleep(100)
Send("p")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("38")
sleep(100)
Send("{ENTER}")
WinWaitActive("µTorrent 1.8.4")
sleep(100)
WinClose("µTorrent 1.8.4")
sleep(100)
    IniWrite(@WorkingDir & "\media\setting.ini", "torrent status", "key", "1")


Else
    TraySetIcon(@WorkingDir & "\media\off.ico")
    sleep(100)
Run("C:\Program Files\uTorrent\uTorrent.exe")
sleep(100)
WinWaitActive("µTorrent 1.8.4")
sleep(100)
Send("!o")
sleep(100)
Send("p")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("110")
sleep(100)
Send("{ENTER}")
WinWaitActive("µTorrent 1.8.4")
sleep(100)
WinClose("µTorrent 1.8.4")
sleep(100)
 IniWrite(@WorkingDir & "\media\setting.ini", "torrent status", "key", "0")


EndIf
Sleep(1000)




Global $start_time = TimerInit()
$ini = IniRead(@WorkingDir & "\media\setting.ini", "torrent status", "key", "NotFound")


TraySetState()

While 1
 $msg = TrayGetMsg()
 Select
   Case $msg = $aboutitem
       MsgBox(64, "Hakkında:", "Gültekin GÖK copyleft 2009 for everyone")
   Case $msg = $exititem
       ExitLoop
 EndSelect
 
 If TimerDiff($start_time) > 6000 Then 
   MyPing()
   $start_time = TimerInit()
 EndIf
WEnd


Func MyPing()
 $var = Ping("192.168.1.1",500)

 If $var > 0 Then
   $ini = IniRead(@WorkingDir & "\media\setting.ini", "torrent status", "key", "NotFound")
sleep(10)
  If $ini = 0 Then
      TraySetIcon(@WorkingDir & "\media\on.ico")
      sleep(100)
     Run("C:\Program Files\uTorrent\uTorrent.exe")
sleep(100)
WinWaitActive("µTorrent 1.8.4")
sleep(100)
Send("!o")
sleep(100)
Send("p")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("38")
sleep(100)
Send("{ENTER}")
WinWaitActive("µTorrent 1.8.4")
sleep(100)
WinClose("µTorrent 1.8.4")
sleep(100)
   IniWrite(@WorkingDir & "\media\setting.ini", "torrent status", "key", "1")
   Else
        IniWrite(@WorkingDir & "\media\setting.ini", "torrent status", "key", "1")
       TraySetIcon(@WorkingDir & "\media\on.ico")
    EndIf

 Else
     TraySetIcon(@WorkingDir & "\media\off.ico")
     sleep(100)
     Run("C:\Program Files\uTorrent\uTorrent.exe")
sleep(100)
WinWaitActive("µTorrent 1.8.4")
sleep(100)
Send("!o")
sleep(100)
Send("p")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("{TAB}")
sleep(100)
Send("110")
sleep(100)
Send("{ENTER}")
WinWaitActive("µTorrent 1.8.4")
sleep(100)
WinClose("µTorrent 1.8.4")
sleep(100)
   IniWrite(@WorkingDir & "\media\setting.ini", "torrent status", "key", "0")
 EndIf
EndFunc

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.