2 Kwi 2009

Sprawdzenie u uruchamianie GG w Vbs

Dim fso, stream, str, re, name
Dim wsh, oExec

Set wsh   =  CreateObject("WScript.Shell")
Set oExec = wsh.Exec("cmd /c " & "tasklist | find " & Chr(34) & "gg.exe" & Chr(34))
wynik     = oExec.StdOut.ReadAll

'msgbox wynik

Dim valid
Set objRegEx = CreateObject("VBScript.RegExp")

valid = False
objRegEx.Pattern = "^gg.exe"
valid = objRegEx.test(wynik)

If valid = True Then
 "MsgBox(wynik)
Else
    wsh.Run Chr(34) & "C:\\Program Files\\Gadu-Gadu\\gg.exe" & Chr(34)
    Set wsh = Nothing
End if
28 Lis 2008

Obsługa daty w VBScript

<head>
<script language="VBScript">
 sub ustaw()
 form1.date1.value = date()
 form1.date2.value = dateadd("m",-1,date())
end sub
</script>

</head>
<body>
  <form name="form1" method="post">
    <input type="button" value="Ustaw date" name="buttonname" onclick="ustaw"/>
    data
    <input id="date1" type="text" name="datefrom" size="20"/>
    data: miesiac -1
    <input id="date2" type="text" name="dateto" size="20"/>
  </form>
 </body>
</html>