From: "Marvin Gülker" Date: 2009-12-29T21:27:49+09:00 Subject: Re: au3 0.1.1 released Thank you, Edward, that helped me out a lot. :) My code now looks like this (to simplify this for the moment, I sticked to the non-unicode variant): --------------------------------- #Encoding: UTF-8 require "win32/api" GetLastError = Win32::API.new("GetLastError", '', 'I', "kernel32") SendInput = Win32::API.new("SendInput", 'IPI', 'I', "user32") #Needed for the KEYBDINPUT struct's last parameter GetMessageExtraInfo = Win32::API.new("GetMessageExtraInfo", '', 'P', "user32") INPUT_KEYBOARD = 1 KEY_A = 0x41 #KEYEVENTF_UNICODE = 0x0004 input = [ INPUT_KEYBOARD, KEY_A, 0, 0, 0, GetMessageExtraInfo.call ].pack('issiiP') #While the program pauses, I click into an editor window #to see wheather I get the 'a' or not. sleep 3 SendInput.call(1, input, input.size) p GetLastError.call --------------------------------- I'm using Ruby 1.9.1-p243 at the moment (will update to -p376 soon), but I've checked that Array#pack returns a BINARY-encoded string, so there shouldn't occur a problem. Nevertheless, I get error code 87, what means "One of the parameters was invalid.". I suppose it's the C array I don't provide, even if it contains only one element. Do you know how to build up one? Marvin -- Posted via http://www.ruby-forum.com/.