aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: xp remote script  (Read 15381 times)

gratou

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
xp remote script
« on: July 09, 2006, 04:39:11 AM »

Hi all,
I am tempted to move from emule to amule to use the amulecmd feature. Not sure what i want to do is possible though:
- my bandwidth is ridiculously low, and i'd like a script on my "normal" PC to run every minute (or whatever) and if firefox is started, send a msg to the amule PC for all downloads to pause, otherwise send a msg for all dowloads to resume.

if that possible you think? has it ever been done? how? any feedback welcome.

cheers, chris
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: xp remote script
« Reply #1 on: July 09, 2006, 08:19:02 AM »

Hi Chris!

Everything you need is a reduced upload of aMule, you don't have to pause all downloads. You should use a lower hard limit as well respectively reduce the number of total sources in general to reduce the overhead.
About the scripting: Which operating systems are you using? And could you please tell us about the capacities of your line?
Logged

gratou

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
Re: xp remote script
« Reply #2 on: July 10, 2006, 06:23:39 AM »

Thank you so much for a swift reply!  :o)

both PCs run xp, and the limit is 64k ul and dl (speed limit in beautiful but backward New Zealand after data cap is reached).
pausing is probably the best option as this speed as not enough for even browsing.
It is alright, we have learnt to live with it. This explains the dedicated p2p box (compaq slimline pentium 350/128MB), running 24/7, even tho it sometimes seems like trying to fill a swimming pool through a straw.

Thx again, cheers, Chris
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: xp remote script
« Reply #3 on: July 10, 2006, 02:17:47 PM »

Heck, It's been a while since I used vbscript...

Modify the check.vbs according to your setup and give it a try. If you want to stop the script, execute the stop.vbs file.

Should be executed from within the amulecmd-folder in its default configuration.
Logged

gratou

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
Re: xp remote script
« Reply #4 on: July 11, 2006, 08:02:43 AM »

My, this looks mightily impressive :baby:, thank you so much for this.
I'll give it a go this week end for sure.

Just 2 things to clarify:
- This runs on the amule server or on the "regular" PC? From my (poor) understanding of what the script does, it seems that it uses amulecmd on the PC and amule on the remote box. Is that right? One component each side?
- the password is the NT account one? no userid?

Also (please feel free to refuse), I just thought that in case the PC is shut down brutally, the resume will never happen. would it be easy enough to run a similar script on the amule box and ping the PC and resume if ping fails (I'll have to reauthorise pinging in my firewall rules, but what the heck...)?

Thanks again, I am just in awe I must say...  :D
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: xp remote script
« Reply #5 on: July 11, 2006, 08:20:41 AM »

The Script is supposed to run on the pc where you want to surf with Firefox. It will send the commands via amulecmd to whatever PC runnung amule(d) you want to sent it. You just have to specify the IP address, the port and the ec-pass.

The password is the ec-password for amule.

I actually shouldn't do that (due to a lack of time), but here's the resume.vbs [Well, shameless copying of the previous script ;)] file you put into the same folder as the ping.vbs-file I'll provide soon:
Code: [Select]
Option Explicit

Dim WshShell

Set WshShell = WScript.CreateObject("WScript.Shell")

Dim amulecmd, host, port, password, i, cmd

amulecmd="amulecmd"
host="192.168.1.15"
port="4712"
password="test"

   '### Resume Downloads ###
 for each i in list()
  cmd = amulecmd & " --host=" & host & " --port=" & port & " --password=" & password & " --command=""resume " & i & """"
  WshShell.Exec(cmd)
 next

WScript.Quit

Function list()
  Dim oExec, input, cmd

  cmd = amulecmd & " --host=" & host & " --port=" & port & " --password=" & password & " --command=""Show DL"""
  Set oExec = WshShell.Exec(cmd)

  Do While Not oExec.StdOut.AtEndOfStream
    input = input & oExec.StdOut.Read(1)
  Loop

 Dim pos, cnt, array()
 pos = 1
 cnt = 0
 do while pos <> 0
  pos = instr(pos+1, input, "> ")
  ReDim Preserve array(cnt+1)
  array(cnt) = mid(input, pos+2, 32)
  cnt = cnt + 1
  ReDim Preserve array(cnt+1)
 loop
  ReDim Preserve array(cnt-1)
  list=array
End Function

ping.vbs (to be executed on the amule-machine, not testet, shameless copy'n'paste from MSDN):
Code: [Select]
Option Explicit

host="192.168.1.15"

do
 WScript.Sleep (1000*60)
loop While (ping(host))

WScript.Run "resume.vbs"
WScript.Quit

Function ping(strComputer)
Dim ObjShell, objScriptExec, strComputer, strPingResults, success
 Set objShell = CreateObject("WScript.Shell")
 Set objScriptExec = objShell.Exec( "ping -n 2 -w 1000 " & strComputer)
  strPingResults = LCase(objScriptExec.StdOut.ReadAll)
  If InStr(strPingResults, "reply from") Then
     If InStr(strPingResults, "destination net unreachable") Then
         success=False
     Else
         success=True
     End If
 Else
    success=False
 End If
ping=success
End Function
Logged

gratou

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
Re: xp remote script
« Reply #6 on: July 12, 2006, 11:27:52 AM »

Wanna marry me?     ;)  :D

I should manage to tweak the ping script so it runs all the time; I think I understand that once the host is dead, the resume will take place and the script will abort, but there is no reason why a little cut and paste can't make it run forever...  :)

Just can't wait to try all of this. I just wish http://download2.berlios.de/amule/aMule-2.1.3-installer.exe
would quit telling me
Too many clients for /amule/aMule-2.1.3-installer.exe

I have been trying for 3 days now. :rolleyes:

Thanks again, Chris
« Last Edit: July 12, 2006, 11:53:20 AM by gratou »
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: xp remote script
« Reply #7 on: July 12, 2006, 01:52:46 PM »

Logged
concordia cum veritate

gratou

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
Re: xp remote script
« Reply #8 on: July 13, 2006, 03:19:57 AM »

cheers mate :)
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: xp remote script
« Reply #9 on: July 14, 2006, 02:59:46 PM »

Quote
Wanna marry me?
I can cook for myself and I can take care of technical things. :P
No reason to marry. ;)

Back to serious mode: You're welcome. I'm glad that my scripts did help you.
Logged