Jump to content

Recommended Posts

Posted

Hi Guys and Gals,

I believe I may be barking up the incorrect tree here when trying to implement sending a sequence of keystrokes with ControlSend to a specific window [Only works on controls?].

For example, the following works for moving a window from one monitor to another;

Send("{CTRLDOWN}{LWINDOWN}{X DOWN}")

However, the following does not work;

ControlSend($hWnd, "", "", "{CTRLDOWN}{LWINDOWN}{X DOWN}")

Example of the complete code (with Function ControlSend)

_Initialize_Alpha()
Exit

Func _Initialize_Alpha()
local $moveToMonitor01 = "{CTRLDOWN}{LWINDOWN}{X DOWN}" ; Hotkey sequence
local $proc = "C:\temp\app01.exe" ; Application to run
Run($proc, "", @SW_MAXIMIZE) ; Run application with Maximized condition
Local $hWnd = WinWait ("application01", "", 7) ; Wait for specific process run from script
Local $iPID = WinGetProcess($hWnd) ; Retrieve process id of run process
sleep(500) ; sleep
ControlSend($hWnd, "", "", "{CTRLDOWN}{LWINDOWN}{X DOWN}") ;Moves window to monitor02
EndFunc

I currently have duel monitors, and when I wish to launch internet browser (firefox) with multiple instance of the browser, I don't wish to have to manually press hotkey or mouse click to move the window to another screen while I am studying.

I could also set this up for other programs like OpenOffice etc.

 

Thanks in advance,

Mono

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...