JPS: VBS: ScrollLock-LED soll blinken während Download läuft

Beitrag lesen

Hallo

seid geraumer Zeit schlage ich mich mit folg. Problem herum und
bekomme es nicht gelöst. Hab mich dumm und dämlich gegoogelt und habe
mittlerweile wohl ein Brett vorm Kopf:
Während Download mittels "Wget.exe" im "Hide-Modus" - run(Application, 0, true) - soll
die "ScrollLock-LED" zur optischen Kontrolle blinken. Ich dachte ich könnte
die "Länge des ReturnCode" der Anwendung dazu benutzen -> Solange kein
Rückgabewert "Len(ReturnCode)=0" blinken, bei irgend einem
Rückgabewert "Len(ReturnCode)>0" blinken-stop - aber da ist offensichtlich
ein Denkfehler drin.

Ich hoffe ich hab's einigermaßen verständlich beschrieben.
Bitte keine Vorschläge wie: "Da gibts extra Programme für."

GetFile.vbs
-------------------------- snip --------------------------
Option Explicit

Dim wss          : Set wss      = CreateObject("WScript.Shell")
  Dim zipfile      : zipfile      = "http://downloads1.kaspersky-labs.com/zips/av-i386-weekly.zip"
  Dim downloadpath : downloadpath = "C:\Dokumente und Einstellungen"
  Dim logfile      : logfile      = downloadpath & "\Download.log"
  Dim debug        : debug        = 1   ' 0=Debug auf Konsole; 1=Debug in Logfile
  Dim wndmode      : wndmode      = 3   ' 0=hide; 1=default; 2=minimized; 3=maximized

GetFile zipfile,downloadpath,debug,logfile,wndmode

'.: clear :.
  Set wss          = nothing
  Set zipfile      = nothing
  Set downloadpath = nothing
  Set logfile      = nothing
  Set debug        = nothing
  Set wndmode      = nothing

' Function FlashLight(n,s1,sl1,s2,sl2,mode)
' hier eine vereinfachte
'************************
Function FlashLight()
'************************
  ' solange der Download - Wget - läuft,
  ' soll die Funktion FlashLight() (in einer Schleife?) ausgeführt werden.
  ' Do While Len(ReturnCode) = 0   'funktioniert aber nicht!

' vereinfachte Funktion:
      wscript.sleep 220
      wss.sendkeys "{SCROLLLOCK}"
      wscript.sleep 220
      wss.sendkeys "{SCROLLLOCK}"
      wscript.sleep 220
      wss.sendkeys "{SCROLLLOCK}"

wscript.sleep 850
      wss.sendkeys "{SCROLLLOCK}"
      wscript.sleep 850
      wss.sendkeys "{SCROLLLOCK}"
      wscript.sleep 850
      wss.sendkeys "{SCROLLLOCK}"

wscript.sleep 1000

'If Len(ReturnCode) > 0 Then Exit Do   'siehe oben - funktioniert nicht!
  'Loop
  Exit Function
End Function
'************************

'************************
Function GetFile(sfile,dest,plog,logfile,wndstate)
'************************
  ' plog (0=Debug auf Konsole; 1=Debug in Logfile)

' WGet Parameter
  ' --------------
  ' -t (Number of Tries)
  ' -T (Network "timeout" in sec)
  ' -N (Turn on time-stamping)
  ' -P (Präfix for Downloadpath)
  ' -o (Präfix for Logfile)

Dim appl : appl = "WGet.exe -t 3 -T 10 -N -P "

Dim vt
    Select Case plog
      Case 0  vo  = ""
      Case 1  vo  = "-o "
    End Select

Dim srun : srun = appl & chr(34) & dest & chr(34) & _
                    chr(32) & sfile & chr(32) & _
                    vt & chr(34) & logfile & chr(34)

'Zu Testzwecken nachfolgende Zeile entkommentieren.
  MsgBox srun, vbExclamation + vbOKOnly + vbSystemModal, "Function Wget()"

Set appl = nothing
  Set vt   = nothing

Dim ReturnCode

'hier geht's nicht weiter denn ...steckt in der Schleife fest
  ' und kann somit den Schritt "ReturnCode = wss.run(..." nicht ausführen
  FlashLight

ReturnCode = wss.run(srun, wndstate, true)

Set srun = nothing

Select Case ReturnCode
      Case -1   MsgBox "Abbruch durch Benutzer!", _
                        vbExclamation + vbOKOnly + vbSystemModal, _
                       "ERROR-Code(" & ReturnCode & ")"
                Set ReturnCode = nothing
                Exit Function

Case 0    MsgBox "Download beendet.", _
                        vbExclamation + vbOKOnly + vbSystemModal, _
                       ".:: WGet ::."
                Set ReturnCode = nothing
                Exit Function

Case 1    MsgBox "Server-Fehler!", _
                        vbExclamation + vbOKOnly + vbSystemModal, _
                       "ERROR-Code(" & ReturnCode & ")"
                Set ReturnCode = nothing
                Exit Function

Case Else MsgBox "Unbekannter Fehler!", _
                        vbExclamation + vbOKOnly + vbSystemModal, _
                       "ERROR-Code(" & ReturnCode & ")"
                Set ReturnCode = nothing
                Exit Function
    End Select

End Function
'************************
-------------------------- snip --------------------------