Ryswick Posted October 31, 2011 Share Posted October 31, 2011 Hello everyone, I searched for this topic, but didn't find anything. I am using ControlSend to send commands to a window, and it works great until I ask it to Alt F4 out of the window. It looks something like this: ControlSend("COM2", "", "", "!+{F4}") Instead of sending the Alt F4 command to the COM2 window, it sends it to the active window instead. Is there an argument or flag I need to specify? Link to comment Share on other sites More sharing options...
iamtheky Posted October 31, 2011 Share Posted October 31, 2011 (edited) Opt("WinTitleMatchMode", 2) winactivate("Window that contains COM2") winwaitactive("Window that contains COM2") send ("!{F4}") Edited November 1, 2011 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
BitByteBit Posted November 1, 2011 Share Posted November 1, 2011 ControlSend("COM2", "", "", "!+{F4}")!+{F4} is Alt + Shift + F4, not Alt + F4. Does ControlFocus help? The same behavior you described is exhibited in the following example without it. Run('notepad') Run('explorer /root,') WinWaitActive('Untitled') WinWaitActive('Computer') ControlFocus('Untitled', '', 'Edit1') ControlSend('Untitled', '', 'Edit1', '!{F4}') Exit Link to comment Share on other sites More sharing options...
Ryswick Posted November 1, 2011 Author Share Posted November 1, 2011 My error on the !+{F4}. I should have realized it was incorrect. It still did its job though. So I take it alt commands don't work with CommandSend? Is focusing the window and then sending the alt f4 command a work-around or the only way? Thanks for the replies though, you two. Link to comment Share on other sites More sharing options...
BitByteBit Posted November 1, 2011 Share Posted November 1, 2011 My point was that you should try using ControlFocus. Link to comment Share on other sites More sharing options...
Blue_Drache Posted November 2, 2011 Share Posted November 2, 2011 (edited) Because WinClose() isn't good enough? Edited November 2, 2011 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now