Auteur : Michel Claveau
Date : 29/04/2007
Citation :
Bonjour !
C'est composé de deux parties.
1ère partie, l'éditeur de sites. Il faut ajouter des URL à interdire.
Par exemple : http://microsoft.com http://www.microsoft.com
Puis sauvegarder
Code : Tout sélectionner
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
GUICreate("url NOT edit", 420, 550)
$sauver=GUICtrlCreateButton("Sauvegarder", 60, 10, 150)
$quitter=GUICtrlCreateButton("Quitter", 220, 10, 150)
$edit=GUICtrlCreateEdit("", 10,40,400,500,$ES_AUTOVSCROLL+$WS_VSCROLL+$ES_MULTILINE+$ES_WANTRETURN)
GUISetState ()
$fichier=@ScriptDir & "urlNOT.txt"
$data=FileRead($fichier)
GUICtrlSetData($edit, $data)
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Select
Case $msg=$quitter or $msg=$GUI_EVENT_CLOSE
ExitLoop
Case $msg=$sauver
$data=GUICtrlRead($edit)
$file = FileOpen($fichier, 2)
FileWrite($file,$data)
FileClose($file)
;msgbox(0,"data",$data)
EndSelect
Wend
Il suffit de le lancer. Ensuite, il fonctionne pendant 12 heures, ou jusqu'à ce que l'on saisisse, dans IE, l'URL : about:fin
Lorsqu'il est en route, lancez Internet-Explorer, puis tentez d'aller sur un des sites interdits. Dans la demi-seconde qui suit, IE est redirigé vers un autre site, bien meilleur.
Code : Tout sélectionner
#NoTrayIcon
#include <IE.au3>
#include <Array.au3>
#include <File.au3>
Opt("WinTitleMatchMode", 2)
Dim $non
$fichier=@ScriptDir & "urlNOT.txt"
_FileReadToArray($fichier,$non)
$nb=3600*12*2 ;pendant 12 heures
While 1
$h=WinGetHandle("Internet Explorer")
if @error Then
; pas d'erreur
Else
$oIE = _IEAttach($h, "HWND")
if @error Then
;pass
Else
$url = _IEPropertyGet($oIE, "locationurl")
if $url="about:fin" Then ;pour arrêter le programme
Exit
EndIf
if StringRight($url,1)="/" Then
$url=StringLeft($url,StringLen($url)-1)
EndIf
$flag=False
for $unon In $non
if StringLen($unon)>1 Then
if StringInStr( $url, $unon)>0 Then
$flag=True
ExitLoop
EndIf
EndIf
Next
if $flag=True Then
_IENavigate($oIE, "http://mclaveau.com")
EndIf
EndIf
EndIf
sleep(500)
$nb-=1
if $nb<0 Then
ExitLoop
EndIf
WEnd