nemolorn Posted June 4, 2012 Share Posted June 4, 2012 I don't have the Key codes memorized, so I put this script together to put together Hot Key Combinations for me because the sendKey function doesn't seem to work reliably with some parts of the game I'm working with. [scar]Procedure NLSHK(ctrl,alt,shift,winkey,command:string); begin IF Uppercase(ctrl) = 'TRUE' then Keydown(17) else ctrl := ''; IF Uppercase(alt) = 'TRUE' then Keydown(18) else alt := ''; IF Uppercase(shift) = 'TRUE' then Keydown(16) else shift := ''; IF Uppercase(winkey) = 'TRUE' then Keydown(92) else winkey := ''; command := Uppercase(command) IF Length(Command) = 1 Then Keydown(strget(Command,1)) Else IF StrtoInt(GetLetters(Command)) > 1 Then Case command of 'BACKSPACE' :Keydown(8); 'TAB' :Keydown(9); 'ENTER' :Keydown(13); 'SHIFT' :Keydown(16); 'ALT' :Keyup(18); 'CAPS LOCK' :Keydown(20); 'CAPS' :Keydown(20); 'CAPSLOCK' :Keydown(20); 'ESC' :Keydown(27); 'SPACEBAR' :Keydown(32); 'SPACE' :Keydown(32); 'PAGE UP' :Keydown(33); 'PAGEUP' :Keydown(33); 'PG UP' :Keydown(33); 'PGUP' :Keydown(33); 'PAGE DOWN' :Keydown(34); 'PAGEDOWN' :Keydown(34); 'PG DOWN' :Keydown(34); 'PGDOWN' :Keydown(34); 'END' :Keydown(35); 'HOME' :Keydown(36); 'LEFT' :Keydown(37); 'UP' :Keydown(38); 'RIGHT' :Keydown(39); 'DOWN' :Keydown(40); 'PRINTSCREEN' :Keydown(44); 'PRTSCRN' :Keydown(44); 'PRINT SCREEN' :Keydown(44); 'PRT SCR' :Keydown(44); 'INSERT' :Keydown(45); 'COPY' : Keydown(67); 'PASTE' : Keydown(86); 'CUT' :Keydown(88); 'WINDOWS' :Keydown(92); 'START' :Keydown(92); 'UNDO' :Keydown(90); 'F1' :Keydown(112); 'F2' :Keydown(113); 'F3' :Keydown(114); 'F4' :Keydown(115); 'F5' :Keydown(116); 'F6' :Keydown(117); 'F10' :Keydown(121); 'NUMLOCK' :Keydown(144); 'NUM LOCK' :Keydown(144); 'NUM' :Keydown(144); end Else IF Length(Command) <1 Then Writeln('Fatal Error'); wait(250) IF Uppercase(ctrl) = 'TRUE' then begin Keyup(17) ctrl := 'ctrl' end else; IF Uppercase(alt) = 'TRUE' then begin Keyup(18) alt := 'alt' end else; IF Uppercase(shift) = 'TRUE' then begin Keyup(16) shift := 'shift' end else; IF Uppercase(winkey) = 'TRUE' then begin Keyup(92) winkey := 'winkey' end else; IF Length(Command) = 1 Then Keyup(strget(Command,1)) Else IF StrtoInt(GetLetters(Command)) > 1 Then Case command of 'BACKSPACE' :Keyup(8); 'TAB' :Keyup(9); 'ENTER' :Keyup(13); 'SHIFT' :Keyup(16); 'ALT' :Keyup(18); 'CAPS LOCK' :Keyup(20); 'CAPS' :Keyup(20); 'CAPSLOCK' :Keyup(20); 'ESC' :Keyup(27); 'SPACEBAR' :Keyup(32); 'SPACE' :Keyup(32); 'PAGE UP' :Keyup(33); 'PAGEUP' :Keyup(33); 'PG UP' :Keyup(33); 'PGUP' :Keyup(33); 'PAGE DOWN' :Keyup(34); 'PAGEDOWN' :Keyup(34); 'PG DOWN' :Keyup(34); 'PGDOWN' :Keyup(34); 'END' :Keyup(35); 'HOME' :Keyup(36); 'LEFT' :Keyup(37); 'UP' :Keyup(38); 'RIGHT' :Keyup(39); 'DOWN' :Keyup(40); 'PRINTSCREEN' :Keyup(44); 'PRTSCRN' :Keyup(44); 'PRINT SCREEN' :Keyup(44); 'PRT SCR' :Keyup(44); 'INSERT' :Keyup(45); 'COPY' : Keyup(67); 'PASTE' : Keyup(86); 'CUT' :Keyup(88); 'WINDOWS' :Keyup(92); 'START' :Keyup(92); 'UNDO' :Keyup(90); 'F1' :Keyup(112); 'F2' :Keyup(113); 'F3' :Keyup(114); 'F4' :Keyup(115); 'F5' :Keyup(116); 'F6' :Keyup(117); 'F10' :Keyup(121); 'NUMLOCK' :Keyup(144); 'NUM LOCK' :Keyup(144); 'NUM' :Keyup(144); end Else IF Length(Command) <1 Then Writeln('Fatal Error'); Writeln(ctrl+alt+shift+winkey+command) end;[/scar] Quote Link to comment Share on other sites More sharing options...
BryceTheCoder Posted July 9, 2012 Share Posted July 9, 2012 oh wow dude thats rlly nice, great job:) Quote Link to comment Share on other sites More sharing options...
LordJashin Posted July 9, 2012 Share Posted July 9, 2012 (edited) VK_, codes are awesome Edited July 9, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...