30 maj 2008

Wyświetlanie kodów ascii znaków

$__search = 'żądło';

$cnt = strlen($__search);
for($i=0; $i<$cnt; $i++) 
   echo $__search[$i].': '.ord($__search[$i]).' , '.dechex(ord($__search[$i])).' <br>';

Dla zmiennej wysłanej z formularza ze strony kodowanej w UTF-8 wygląda to tak:

ź 197, c5
?: 188, bc
ĺ 196, c4
?: 133, 85
d: 100, 64
ź 197, c5
?: 130, 82
o: 111, 6f

29 maj 2008

Uruchomienie i zamknięcie notatnika, notepad

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("Notepad")
Wscript.Sleep 3000

WshShell.AppActivate("Bez tytułu - Notepad")
WshShell.SendKeys("Dodanie tekstu po 3 sekundach")
WScript.Sleep 3000
WshShell.SendKeys "%{F4}"
Set WshShell = Nothing
WScript.Quit 0
29 maj 2008

Uruchomienie kliku aplikacji

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

'Launch a couple of applications
WshShell.Run "NOTEPAD.EXE", 1, False
WshShell.Run "CALC.EXE", 1, False
WshShell.Run "WORDPAD.EXE", 1, False
29 maj 2008

Wykonanie operacji matematycznych w kalkulatorze

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

WshShell.Run( "calc")
Wscript.Sleep (100)
WshShell.AppActivate( "Calculator")
Wscript.Sleep (100)
WshShell.SendKeys( "1{+}")
Wscript.Sleep (500)
WshShell.SendKeys ("2")
Wscript.Sleep (500)
WshShell.SendKeys( "=")
Wscript.Sleep (500)
WshShell.SendKeys( "*4" )
Wscript.Sleep (500)
WshShell.SendKeys( "=" )
' 1+2 = 3  * 4 = 12