Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

???: Restore WindowSettings on Process-Generation #35

Open
hoppfrosch opened this issue Aug 13, 2015 · 1 comment
Open

???: Restore WindowSettings on Process-Generation #35

hoppfrosch opened this issue Aug 13, 2015 · 1 comment

Comments

@hoppfrosch
Copy link
Owner

On creation of a process the opened windows should be restored to predefined settings (for example window size & position)

Idea taken from: http://ahkscript.org/boards/viewtopic.php?f=5&t=9169

``#Persistent
winmgmts := ComObjGet("winmgmts:")
createSink := ComObjCreate("WbemScripting.SWbemSink")
ComObjConnect(createSink, "ProcessCreate_")
interval := 1
winmgmts.ExecNotificationQueryAsync(createSink, "SELECT * FROM __InstanceCreationEvent WITHIN "
. interval . " WHERE TargetInstance ISA 'Win32_Process' AND TargetInstance.Name='notepad.exe'" )
return

ProcessCreate_OnObjectReady(objWbemObject, objWbemAsyncContext)
{
WinMove, % "ahk_pid " objWbemObject.TargetInstance.ProcessId,, 100, 200, 300, 400
}``

@hoppfrosch hoppfrosch self-assigned this Aug 13, 2015
@hoppfrosch hoppfrosch removed their assignment Aug 13, 2015
@hoppfrosch
Copy link
Owner Author

See also: https://bitbucket.org/klomb/frontandcenter (will automatically move new windows to the monitor the mouse is currently in and center them, if the window is maximized it will try to restore, move and maximize the window again.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant