REM ************************
REM Fichier : g.vbs
REM Desc : Quick search avec Google
REM ************************
dim WshShell, cmdLine2, colArg
Set WshShell = WScript.CreateObject("WScript.Shell")
IF Wscript.Arguments.Count = 0 Then
Msgbox "Entrer le requête Google en paramètre."
Wscript.Quit(0)
ElseIf LCase(Wscript.Arguments(0)) = "edit" Then
ShellRun "notepad " & Wscript.ScriptFullName
Wscript.Quit(0)
End If
Dim i
cmdLine2 = Wscript.Arguments(0)
For i=1 To Wscript.Arguments.Count-1
cmdLine2 = cmdLine2 & "+" & Wscript.Arguments(i)
Next
browserFirefox = """C:\Program Files\Mozilla Firefox\firefox.exe"""
browserIExplorer = "iexplore"
browser = browserIExplorer
'REM recherche normale
Google1 = "http://www.google.fr/search?hl=fr&q="
Google2 = "&btnG=Recherche+Google&meta="
'REM J'ai de la chance
'http://www.google.Fr/search?hl=fr&q=cest+poas+possible&btnI=J%27ai+de+la+chance&meta=&aq=f&oq=
REM Google1 = "http://www.google.fr/search?hl=fr&q="
REM Google2 = "&btnI=J%27ai+de+la+chance&meta=&aq=f&oq="
cmdLine2 = _
Google1 & _
cmdLine2 & _
Google2 & chr(34)
return = WshShell.Run ("cmd /c start " & browser & " " & chr(34) & cmdLine2,0,TRUE)
Function ShellRun(sCmd)
REM ===========================================
REM = Lancer une commande Run de l'object Shell vers le fichier sOutputFile (synchrone)
REM = ATTENTION : toujours vérifier cmd /c !!!
REM ===========================================
'exemples :
'ShellRun "cmd /c sort < u_numerote.txt", "u_numerote_sorted.txt"
'ShellRun "cmd /c dir " & Dossier & " /ad /s /b ", sReportFile
Dim oShell
Set oShell = CreateObject("Wscript.Shell")
ShellRun = oShell.Run(sCmd, 1, True)
'1 = Activates and displays a window
'true = bWaitOnReturn, Boolean value
'indicating whether the script should
'wait for the program to finish executing
'before continuing to the next statement in your script.
Set oShell = Nothing
End Function