netmeter with avescripter

sorry for my bad english

i have written a little desklet , who i can see the down and up stream , local ip and i-net IP

i see the text and now i would insert a graphic for down and up

who i can that , here the source code by main.vbs

und das ganze in meiner landessprache

hab ein desklet geschrieben in der die ip(local sowie extern) sowie download and upload geschwindigkeit angezeigt wird.

das ganze funktioniert , nun wollte ich das ganze noch grafisch darstellen.

wie muss ich das anstellen?

Dim wshNet 

Dim IPConfigSet

Dim IP

Dim LanIP



Dim objWMI

Dim colClass

Dim objClass

DIM I

Dim NetzWname

Dim LastSend , LastRec

Dim CurSend,CurRec



Dim strComputer



strComputer = "."

LastRec = -1

LastSend = -1



set objwmi = GetObject("winmgmts:" & strComputer & "rootcimv2")

Set WshNet = CreateObject ("Wscript.Network")

SQL="Select BytesReceivedPersec,BytesSentPersec from Win32_PerfRawData_Tcpip_NetworkInterface"'



'call netz()



function IPA()

set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _

("SELECT IPAddress, DefaultIPGateway, IPSubnet FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE")

for each IPConfig in IPConfigSet



if Not IsNull(IPConfig.IPAddress) then

for i = LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)

IP = IPConfig.IPAddress(i)

next

end if



set LanIP = this.Layers("LanIP")

LanIP.Text = IP

next

end function





function netzwerkarte()

set colItems = objwmi.ExecQuery("SELECT * FROM Win32_NetWorkAdapterConfiguration")

for each objitem in colItems

if objitem.IPEnabled then

netzwname = objitem.description

WScript.Echo netzwname

netzwerkarte = netzwname

exit for

end if

next

end function







sub Netz()

'netzwname = netzwerkarte()

netzwname ="Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Adapter, Copper RJ-45"

sql = sql & " WHERE Name = '"& netzwname &"'"







'Set objWMI = GetObject("winmgmts:" & strComputer & "rootcimv2")

Set colClass = objWMI.ExecQuery("Select * from Win32_PerfRawData_Tcpip_NetworkInterface",,48)

'Set colClass = objWMI.ExecQuery(sql,,48)



'WScript.Echo sql



CurSend = 0

CurRec = 0



For Each objClass in colClass

'wscript.echo objclass.name

'WScript.Echo "BytesReceivedPersec: " & objClass.BytesReceivedPersec

'WScript.Echo "BytesSentPersec: " & objClass.BytesSentPersec

CurRec = curRec + objClass.BytesReceivedPersec

CurSend = CurSend + objClass.BytesSentPersec

Next





If LastRec <> 0 then

rval=(CurRec - LastRec)*1000/1000



revalRec = FormatNumber(rval/1024 ,2) & " kb/s"

'WScript.Echo revalrec

set LR = this.Layers("LR")

LR.Text = revalRec

end if

LastRec = CurRec





If LastSend <> 0 then

rval=(CurSend - LastSend)*1000/1000



revalSend = FormatNumber(rval/1024 ,2) & " kb/s"

'WScript.Echo revalrec

set LS = this.Layers("LS")

LS.Text = revalSend

end if

LastSend = CurSend



End sub

thx for help!

#402672

// somewhere on top

Dim oldTotalRec

oldTotalRec = 0

Dim totalRec





totalRec = 0

For Each objClass in colClass

'wscript.echo objclass.name

'WScript.Echo "BytesReceivedPersec: " & objClass.BytesReceivedPersec

'WScript.Echo "BytesSentPersec: " & objClass.BytesSentPersec

totalRec = totalRec + objClass.BytesReceivedPerSec

CurRec = curRec + objClass.BytesReceivedPersec

CurSend = CurSend + objClass.BytesSentPersec

Next



if oldTotalRec > totalRec

this.layers('arrow').src = 'down.png'

else

this.layers('arrow').src = 'up.png'

end if

oldTotalRec = totalRec

#402686

thx for the tipp

if oldTotalRec <> totalRec

this.layers("arrow").src = "down.png"

else

this.layers("arrow").src = "up.png"

end if

oldTotalRec = totalRec

after changing it worked

here the picture http://www.sa-dg.de/avescripter/pic.png

but i see not a meter , that is another problem. i think here must i insert a timer

i want select the networkinterface

the code is

option explicit

Dim strComputer

Dim SQL

Dim objWMI

Dim colClass

Dim objClass

dim colItems

dim objitem

dim NetzWname

strComputer = "."

set objwmi = GetObject("winmgmts:" & strComputer & "rootcimv2")

SQL="Select * from Win32_PerfRawData_Tcpip_NetworkInterface"

call gewaehlt()

function netzwerkarte()

set colItems = objwmi.ExecQuery("SELECT * FROM Win32_NetWorkAdapterConfiguration")

for each objitem in colItems

if objitem.IPEnabled then

NetzWname = objitem.description

netzwerkarte = NetzWname

end if

next

end function

sub gewaehlt()

NetzWname = netzwerkarte() '-->with that not work

'NetzWname = "Marvell Yukon Gigabit Ethernet 10_100_1000Base-T Adapter, Copper RJ-45 - Paketplaner-Miniport" '-->with this then worked

wscript.echo netzwname

sql = sql &" where Name ="

sql = sql & "'"& NetzWname &"'" "The parameter by function do not work , when i take the parameter near the 2. netwname then worked. where is the mistake? "

wscript.echo sql

Set colClass = objWMI.ExecQuery("Select * from Win32_PerfRawData_Tcpip_NetworkInterface",,48)

Set colClass = objWMI.ExecQuery(sql,,48)

For Each objClass in colClass

WScript.Echo "Name: " & objClass.Name

WScript.Echo "BytesReceivedPersec: " & objClass.BytesReceivedPersec

WScript.Echo "BytesSentPersec: " & objClass.BytesSentPersec

Next

end sub

next answer: how i can insert a picture in this forum?

#402889

da dein englisch nich wirklich toll is wie du selber zugibst...schreib ichs in deutsch

mit

[img=url]

kannst du einfach bilder einbaun

und damit man den quellcode von dir vom restlichen post unterscheiden kann nimm bitte

[.code] dein code [/.code]

(ohne die punkte)

das ganze nennt sich BBCode und geht so ziemlich in jedem forum !

wenn du den advanced mode nimmst zum beitrag schreiben kannste das auch einfach mit dem wysiwyg buttons machen ;)

#402901

da dein englisch nich wirklich toll is wie du selber zugibst...schreib ichs in deutsch

mit

[URL="http://url"]url[/URL]

kannst du einfach bilder einbaun

und damit man den quellcode von dir vom restlichen post unterscheiden kann nimm bitte

[.code] dein code [/.code]

(ohne die punkte)

das ganze nennt sich BBCode und geht so ziemlich in jedem forum !

wenn du den advanced mode nimmst zum beitrag schreiben kannste das auch einfach mit dem wysiwyg buttons machen ;)

danke für den tipp (aber da ich die einstelliung nicht kannte (wysiwyg buttons) war ichh der meinung das der html code für ****ies gesperrt ist) , aber hast du ne ahnung warum das script nicht funktioniert?

#402916

alles ausser web-programmierung is nich mein ding sorry ;)

#402929

how i can draw a line with canvas in vbs

#403591

how i can draw a line with canvas in vbs

Using the current beta, you need to first have a layer declared src="../../unavailable.html". (Upcoming version will have support for overlaying I hope)

Then all you need to do is

layer.canvas.src.DrawLine(10,10,100,100) 'draw from 10,10 to 100,100

#403813

its doesn't work!!!

here my example

xml-file

<?xml version="1.0" encoding="UTF-8"?>

Sa-DG

canvastest

canvastest

1

255

Controls

VBScript

<script>main.vbs

<scriptkeyevent/>

Start()

and the vbs-file

sub start()

layers.canvas.src.setpixel 10,10,vbgreen

layer.canvas.src.DrawLine 10,10,100,100

end sub

error log

438 Laufzeitfehler in Microsoft VBScript

Das Objekt unterstützt diese Eigenschaft oder Methode nicht.: 'layers.canvas' Line:2 Column:0

-------------------------------

438 Laufzeitfehler in Microsoft VBScript

Das Objekt unterstützt diese Eigenschaft oder Methode nicht.: 'layers.canvas' Line:2 Column:0

-------------------------------

i have the avescripter 1.06 beta

#404222

Dim l 'as layer

set l = this.layers("CANVAS")

l.canvas.src.setpixel 10,10,vbgreen

l.canvas.src.DrawLine 10,10,100,100

#404228

Dim l 'as layer
set l = this.layers("CANVAS")
l.canvas.src.setpixel 10,10,vbgreen
l.canvas.src.DrawLine 10,10,100,100

i have make that , i have no mistake but i see no line

#404247

its so simply

I must still this

Dim l 'as layer

set l = this.layers("CANVAS")

l.canvas.src.setpixel 10,10,vbgreen

l.canvas.src.DrawLine 10,10,100,100

this.redraw(true)

#405679

my first widget is ready

front.png

back.png

the frontpicture is from ah-weather

download

install: extract i-status.rar in avedesk/desklets/avescripter/

a install script follow

#406316

cool,

I haven't tried it, but too busy this week. but once your done, you should upload it to avedesk.org

:)

#406461

Very nice, this is way cool!!

Thanks mate :D

#406465

cool,

I haven't tried it, but too busy this week. but once your done, you should upload it to avedesk.org

:)

how i can upload ?

#406506

how i can upload ?

Just go to the website, avedesk.org and create an account, only registered accounts can upload.

#406619

Just go to the website, avedesk.org and create an account, only registered accounts can upload.

on this page i can't create a account!

there is nothing for register

#406633

thx for link

i have registered , but where i can upload

i see the user menu but early nothing

i have founded :-)

#406640