View Single Post
Old 21st April 2016, 10:21   #11
stass
Senior Member
 
Join Date: Nov 2012
Posts: 146
r2du-soft
If you just need to click on the keyboard :

Quote:
OutFile "CalcPress-test.exe"
!include "MUI2.nsh"
!insertmacro MUI_LANGUAGE English

!define VK_DELETE 0x2E ; Delete
!define VK_1 0x31 ; 1
!define VK_2 0x32 ; 2
!define VK_ADD 0x6B ; +
!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 0x0002
!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 "open" "Calc.exe"
Sleep 500
FindWindow $HWND "CalcFrame" "Calculator" ;Basic Window Info - [HWND] [Class] [Title]

Sleep 100
${keybd_event} ${VK_DELETE} 1 ; Reset Calc
Sleep 1000
${keybd_event} ${VK_1} 1
Sleep 1000
${keybd_event} ${VK_ADD} 1
Sleep 1000
${keybd_event} ${VK_2} 1
Sleep 1000
${keybd_event} ${VK_RETURN} 1
SectionEnd
stass is offline   Reply With Quote