PureBasic

Forums PureBasic
Nous sommes le Ven 16/Nov/2018 19:55

Heures au format UTC + 1 heure




Poster un nouveau sujet Répondre au sujet  [ 1 message ] 
Auteur Message
 Sujet du message: emule_keyboard_pressing.pbi
MessagePosté: Sam 26/Mai/2018 0:23 
Hors ligne
Avatar de l’utilisateur

Inscription: Lun 24/Sep/2012 20:57
Messages: 41
Localisation: Somme
Hello camarade codeurs :D
Voici de quoi faire joujou avec le clavier !
(Pas 100% complet, je vous laisse faire le reste :idea: :mrgreen: )

Code:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Procedure emule_keyboard_pressing(text.s)
Protected n.l
For n=1 To CountString(text.s,"|")+1
Delay(20)
If StringField(text.s,n,"|")=UCase(StringField(text.s,n,"|")):keybd_event_(#VK_LSHIFT,0,0,0):EndIf
Select StringField(text.s,n,"|")
  Case "0":keybd_event_(#VK_NUMPAD0,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "1":keybd_event_(#VK_NUMPAD1,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "2":keybd_event_(#VK_NUMPAD2,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "3":keybd_event_(#VK_NUMPAD3,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "4":keybd_event_(#VK_NUMPAD4,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "5":keybd_event_(#VK_NUMPAD5,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "6":keybd_event_(#VK_NUMPAD6,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "7":keybd_event_(#VK_NUMPAD7,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "8":keybd_event_(#VK_NUMPAD8,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "9":keybd_event_(#VK_NUMPAD9,0,0,0):keybd_event_(#VK_NUMPAD0,0,#KEYEVENTF_KEYUP,0)
  Case "A","a":keybd_event_(#VK_A,0,0,0):keybd_event_(#VK_A,0,#KEYEVENTF_KEYUP,0)
  Case "B","b":keybd_event_(#VK_B,0,0,0):keybd_event_(#VK_B,0,#KEYEVENTF_KEYUP,0)
  Case "C","c":keybd_event_(#VK_C,0,0,0):keybd_event_(#VK_C,0,#KEYEVENTF_KEYUP,0)
  Case "D","d":keybd_event_(#VK_D,0,0,0):keybd_event_(#VK_D,0,#KEYEVENTF_KEYUP,0)
  Case "E","e":keybd_event_(#VK_E,0,0,0):keybd_event_(#VK_E,0,#KEYEVENTF_KEYUP,0)
  Case "F","f":keybd_event_(#VK_F,0,0,0):keybd_event_(#VK_F,0,#KEYEVENTF_KEYUP,0)
  Case "G","g":keybd_event_(#VK_G,0,0,0):keybd_event_(#VK_G,0,#KEYEVENTF_KEYUP,0)
  Case "H","h":keybd_event_(#VK_H,0,0,0):keybd_event_(#VK_H,0,#KEYEVENTF_KEYUP,0)
  Case "I","i":keybd_event_(#VK_I,0,0,0):keybd_event_(#VK_I,0,#KEYEVENTF_KEYUP,0)
  Case "J","j":keybd_event_(#VK_J,0,0,0):keybd_event_(#VK_J,0,#KEYEVENTF_KEYUP,0)
  Case "K","k":keybd_event_(#VK_K,0,0,0):keybd_event_(#VK_K,0,#KEYEVENTF_KEYUP,0)
  Case "L","l":keybd_event_(#VK_L,0,0,0):keybd_event_(#VK_L,0,#KEYEVENTF_KEYUP,0)
  Case "M","m":keybd_event_(#VK_M,0,0,0):keybd_event_(#VK_M,0,#KEYEVENTF_KEYUP,0)
  Case "N","n":keybd_event_(#VK_N,0,0,0):keybd_event_(#VK_N,0,#KEYEVENTF_KEYUP,0)
  Case "O","o":keybd_event_(#VK_O,0,0,0):keybd_event_(#VK_O,0,#KEYEVENTF_KEYUP,0)
  Case "P","p":keybd_event_(#VK_P,0,0,0):keybd_event_(#VK_P,0,#KEYEVENTF_KEYUP,0)
  Case "Q","q":keybd_event_(#VK_Q,0,0,0):keybd_event_(#VK_Q,0,#KEYEVENTF_KEYUP,0)
  Case "R","r":keybd_event_(#VK_R,0,0,0):keybd_event_(#VK_R,0,#KEYEVENTF_KEYUP,0)
  Case "S","s":keybd_event_(#VK_S,0,0,0):keybd_event_(#VK_S,0,#KEYEVENTF_KEYUP,0)
  Case "T","t":keybd_event_(#VK_T,0,0,0):keybd_event_(#VK_T,0,#KEYEVENTF_KEYUP,0)
  Case "U","u":keybd_event_(#VK_U,0,0,0):keybd_event_(#VK_U,0,#KEYEVENTF_KEYUP,0)
  Case "V","v":keybd_event_(#VK_V,0,0,0):keybd_event_(#VK_V,0,#KEYEVENTF_KEYUP,0)
  Case "W","w":keybd_event_(#VK_W,0,0,0):keybd_event_(#VK_W,0,#KEYEVENTF_KEYUP,0)
  Case "X","x":keybd_event_(#VK_X,0,0,0):keybd_event_(#VK_X,0,#KEYEVENTF_KEYUP,0)
  Case "Y","y":keybd_event_(#VK_Y,0,0,0):keybd_event_(#VK_Y,0,#KEYEVENTF_KEYUP,0)
  Case "Z","z":keybd_event_(#VK_Z,0,0,0):keybd_event_(#VK_Z,0,#KEYEVENTF_KEYUP,0)
  Case "-":keybd_event_(#VK_SUBTRACT,0,0,0):keybd_event_(#VK_SUBTRACT,0,#KEYEVENTF_KEYUP,0)
  Case "RETURN":keybd_event_(#VK_RETURN,0,0,0):keybd_event_(#VK_RETURN,0,#KEYEVENTF_KEYUP,0)
  Case " ":keybd_event_(#VK_SPACE,0,0,0):keybd_event_(#VK_SPACE,0,#KEYEVENTF_KEYUP,0)
  Case "TAB":keybd_event_(#VK_TAB,0,0,0):keybd_event_(#VK_TAB,0,#KEYEVENTF_KEYUP,0)
  Case "DELAY":n+1:Delay(Val(StringField(text.s,n,"|")))
  Case "BACK":n+1:For t=1 To Val(StringField(text.s,n,"|")):keybd_event_(#VK_BACK,0,0,0):keybd_event_(#VK_BACK,0,#KEYEVENTF_KEYUP,0):Next t
  Case "ALTF4":keybd_event_(#VK_MENU,0,0,0):keybd_event_(#VK_F4,0,0,0):Delay(30):keybd_event_(#VK_F4,0,#KEYEVENTF_KEYUP,0):keybd_event_(#VK_MENU,0,#KEYEVENTF_KEYUP,0)
  Case "SCREENSHOT":keybd_event_(#VK_SNAPSHOT,0,0,0):keybd_event_(#VK_SNAPSHOT,0,#KEYEVENTF_KEYUP,0)
 
EndSelect
If StringField(text.s,n,"|")=UCase(StringField(text.s,n,"|")):keybd_event_(#VK_LSHIFT,0,#KEYEVENTF_KEYUP,0):EndIf
Next n
EndProcedure

;test.s="T|E|S|T|RETURN|DELAY|1000|BACK|5|ALTF4"
;RunProgram("notepad.exe")
;Delay(300)
;emule_keyboard_pressing(test.s)
;
;UseJPEGImageDecoder()
;UsePNGImageDecoder()
;UsePNGImageEncoder()
;
;emule_keyboard_pressing("SCREENSHOT|")
;Delay(600)
;
;If GetClipboardImage(0)
;  total_moniteur = ExamineDesktops()
;If OpenWindow(0, 10, 10, DesktopWidth(0)-10, DesktopHeight(0)-10, "Presse-papier", #PB_Window_SystemMenu)
;   If StartDrawing(WindowOutput(0))
;     DrawImage(0, 10,10)
;     DrawImage(0, WindowWidth(0),WindowHeight(0))
;     StopDrawing()
;   EndIf
;
;   Repeat
;     Event = WaitWindowEvent()
;   Until Event = #PB_Event_CloseWindow
;Debug GetUserDirectory(#PB_Directory_Pictures)+FormatDate("%yyyy-%mm-%dd_%hh%ii",Date())+".png"
; If SaveImage(0,GetUserDirectory(#PB_Directory_Pictures)+FormatDate("%yyyy-%mm-%dd_%hh%ii",Date())+".png",#PB_ImagePlugin_PNG)=0:Debug "erreur sauvegarde.":EndIf
;EndIf
;EndIf

;Delay(100)
;emule_keyboard_pressing("CLS"+#CRLF$)
;Delay(100)
;emule_keyboard_pressing("EXIT"+#CRLF$)
;RunProgram("notepad.exe")
;Delay(300)
;emule_keyboard_pressing(test.s)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEgxMov0ob/+7MaCdTy8T3BYq/nnQFAlsImpEACgkQy8T3BYq/
nnTeiA/+N7tUVpZPJuXb03RYZH+zORFNm81caP81xQth8jjo0Gw600PvHK50lct6
k7z7wyG0/9iQzDbX6dXVH8pJKw/WWMqTKaRytBYQvi7r6Gpb6cxcPl7y31Du3Ztm
cQR3vOH/8JV8l1+Rsm2j+PnC0gaqgVH6rvR89JTPlB58NFBHO30OY1LhCt2X3b5l
pvQJQzVWUxsR9GpI4Q1cfpybxEC2Ra5sVcpNwUb8KePGBr8CWnUEOtY4J3D/ea8x
cP7dQ+L0OmAM8Mz4r0mncoYNl8iOBQdNsyQAcNZZYzTtoCUBQC4MrmRuzWfltnde
GRxvTN8TckOuD3KOH8kmR5ocN/XBIIBYd9UML4a0Cui6dmGY+TZ2Y40ztOOclQ6L
r8D5Vae5FmAIqbTOKpJ+IF8kuvQW930rC8lFx86e0IwQvTy4LWBRW1Mctb7KMiXm
ktub6B9XwODNZWH43PQMX84xmpgcry23v0nNq7xQzIN0rQ1ltnplZ3d77cVkpb83
CzvKbp53z6MHUXZhS34n9ndI7HQS9VlD73AKfVOw3uAULB9ci4jxijMdyhi+4nU6
n9TbqbmwG7ceBGMNOal+sYbHdUf2Q2SQJHqZkzq3AmhAdbGtSvSt3W27ea8O76h2
sPYmJFsV7K4oxU3xbbQuG0TavbqaAsbA9RV3AWmeINtZDjrkfLE=
=rBDG
-----END PGP SIGNATURE-----



Pour vérifier la signature de ce post :
Il faut copier tout ce qui ce trouve entre
Citation:
-----BEGIN PGP SIGNED MESSAGE-----
et
Citation:
-----END PGP SIGNATURE-----


Puis coller sur ma page Keybase : https://keybase.io/verify
Pour m'envoyer des messages : https://keybase.io/encrypt#caussatjerome


Haut
 Profil  
Répondre en citant le message  
Afficher les messages postés depuis:  Trier par  
Poster un nouveau sujet Répondre au sujet  [ 1 message ] 

Heures au format UTC + 1 heure


Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité


Vous ne pouvez pas poster de nouveaux sujets
Vous ne pouvez pas répondre aux sujets
Vous ne pouvez pas éditer vos messages
Vous ne pouvez pas supprimer vos messages

Rechercher:
Aller à:  

 


Powered by phpBB © 2008 phpBB Group | Traduction par: phpBB-fr.com
subSilver+ theme by Canver Software, sponsor Sanal Modifiye