Hi guys I was just wonderin' in a .bat file, if there was a way to call an external .bat file, or even an *.exe and make it open so it 'snaps' to the top left hand corner of the screen ?
Cheers
Hi guys I was just wonderin' in a .bat file, if there was a way to call an external .bat file, or even an *.exe and make it open so it 'snaps' to the top left hand corner of the screen ?
Cheers
There is no direct way to position a Window from the Windows command prompt. You basically have the following options:
Use a GUI automation tool, e.g. AutoHotkey which lets you script window actions. AutoHotkey e.g. offers the WinMove command:
Run, calc.exe
WinWait, Calculator
WinMove, 0, 0 ; Move the window found by WinWait to the upper-left corner of the screen.
Use PowerShell, e.g. with the WASP snapin (http://wasp.codeplex.com/).
Write a short program in C/C++/.NET that will position the active Window at position 0,0 of your main screen.
A very basic program in C#, that takes a window caption as parameter could look like that:
using System;
using System.Runtime.InteropServices;
class Program
{
public const int SWP_NOSIZE = 0x0001;
public const int SWP_NOZORDER = 0x0004;
[DllImport("user32.dll", SetLastError = true)]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
static void Main(string[] args)
{
IntPtr handle = FindWindow(null, args[0]);
SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
}
It's a bit messy but I think it can be done.
You will need to install two programs:
AutoIt
Winsplit Revolution
Create an autoit script to:
1. open the program or batch file you want
2. Wait untill the program is open
3. Make the program the active window
4. Call a ctrl+alt+7, "Send("^!7")" (Winsplit Revolution shortcut to send program to top left corner)
5. End script
If i have time later I'll try to script it