View Single Post
Old 18th October 2020, 22:35   #14
ww.13a20z
Junior Member
 
Join Date: Oct 2020
Posts: 10
hi . How can I release the ctrl button after pressing?

OutFile "my documents.exe"
!include "MUI2.nsh"
!insertmacro MUI_LANGUAGE English

!define VK_CONTROL 0x11 ; 1
!define VK_A 0x41 ; 1
!define VK_DELETE 0x2E
!define VK_RETURN 0x0D ; Enter
!define keybd_event "!insertmacro macro_keybd_event"

var HWND

!macro macro_keybd_event setkey intkey
!ifndef keybd
!define keybd
!define KEYEVENTF_EXTENDEDKEY 0x0001
!define KEYEVENTF_KEYUP 0x0000
!endif
System::Store S
${For} $0 1 ${intkey}
System::Call "user32::keybd_event(i${setkey}, i0x45, i${KEYEVENTF_EXTENDEDKEY}|0, i0)"
System::Call "user32::keybd_event(i${setkey}, i0x45, i${KEYEVENTF_EXTENDEDKEY}|${KEYEVENTF_KEYUP}, i0)"
${Next}
System::Store L
!macroend

Section
ExecShell "" "$EXEDIR\my documents.txt" ""
Sleep 500
${keybd_event} ${VK_CONTROL} 1
Sleep 500
${keybd_event} ${VK_A} 1
Sleep 500
${keybd_event} ${VK_DELETE} 1
SectionEnd: rolleyes:
ww.13a20z is offline   Reply With Quote