vbs script - Anfänger brach mal nen Tip

Diskutiere vbs script - Anfänger brach mal nen Tip im Developer Network Forum im Bereich Hardware & Software Forum; Hallo, ich versuche nen "Programm" zu erstellen, welches (wenn es fertig ist) ein anderes Programm nach einer bestimmten Zeit beenden soll. Beim...
  • vbs script - Anfänger brach mal nen Tip Beitrag #1
KillerKen

KillerKen

Bekanntes Mitglied
Dabei seit
03.03.2001
Beiträge
779
Reaktionspunkte
0
Ort
Wild Wild East
Hallo,
ich versuche nen "Programm" zu erstellen, welches (wenn es fertig ist) ein anderes Programm nach einer bestimmten Zeit beenden soll.
Beim Start beginnt ein sleep, welcher wenn =0 -> Fenster öffnen -> Countdown läuft runter ->anderes Programm Beenden.
Durch Drücken des OK Buttons soll das Fenster zu gehen und der Timer neu starten.

zur Zeit kommt aber nach dem "OK" noch ne Fehlermeldung "Der Remotecomputerexestiert nicht oder ist ...", und der "Neustart" des Vorganges will mir auch nicht gelingen


hier mal das Script:


Timer:

WScript.sleep 500


nMinutes = 0
nSeconds = 10
sMessage = "<font color=red size=+1><b>Programm beenden?</b></font>"

' Open a chromeless window with message
with HTABox("lightgrey", 150, 300, 400, 500)
.document.title = "Programm beenden"
.msg.innerHTML = sMessage
do until (nMinutes + nSeconds < 1)
.msg.innerHTML = sMessage & "<br>" & nMinutes & ":" & Right("0"&nSeconds, 2) _
& " remaining<br>"
wsh.sleep 1000 ' milliseconds
nSeconds = nSeconds - 1
if nSeconds < 0 then
if nMinutes > 0 then
nMinutes = nMinutes - 1
nSeconds = 59

end if
end if
if .done.value then
.done.value = true
.close
wsh.echo "OK Gedrückt"

end if

loop
.done.value = true
.close

end with
wsh.echo "Zeit abgelaufen"
' script ends here


Function HTABox(sBgColor, h, w, l, t)
Dim IE, HTA, sCmd, nRnd

randomize : nRnd = Int(1000000 * rnd)
sCmd = "mshta.exe ""javascript:{new " _
& "ActiveXObject(""InternetExplorer.Application"")" _
& ".PutProperty('" & nRnd & "',window);" _
& "window.resizeTo(" & w & "," & h & ");" _
& "window.moveTo(" & l & "," & t & ")}"""

with CreateObject("WScript.Shell")
.Run sCmd, 1, False
do until .AppActivate("javascript:{new ") : WSH.sleep 10 : loop
end with ' WSHShell

For Each IE In CreateObject("Shell.Application").windows
If IsObject(IE.GetProperty(nRnd)) Then
set HTABox = IE.GetProperty(nRnd)
IE.Quit
HTABox.document.title = "HTABox"
HTABox.document.write _
"<HTA:Application contextMenu=no border=thin " _
& "minimizebutton=no maximizebutton=no sysmenu=no />" _
& "<body scroll=no style='background-color:" _
& sBgColor & ";font:normal 10pt Arial;" _
& "border-Style:inset;border-Width:3px'" _
& "onbeforeunload='vbscript:if not done.value then " _
& "window.event.cancelBubble=true:" _
& "window.event.returnValue=false:" _
& "done.value=true:end if'>" _
& "<input type=hidden id=done value=false>" _
& "<center><span id=msg>&nbsp;</span><br>" _
& "<input type=button id=btn1 value=' OK ' "_
& "onclick=done.value=true><center></body>"
HTABox.btn1.focus
Exit Function
End If
Next

wsh.quit

End Function
 
Thema:

vbs script - Anfänger brach mal nen Tip

ANGEBOTE & SPONSOREN

https://www.mofapower.de/

Statistik des Forums

Themen
213.179
Beiträge
1.579.170
Mitglieder
55.874
Neuestes Mitglied
hnte
Oben