It's basically the VBScript code found there:
viewtopic.php?t=4285
… but translated to JScript. I hoped I would have been able to use the XCountChars and YCountChars members of the Win32_ProcessStartup class to run the CMD process with the window size already adjusted. That didn't work though. I had to use the MODE command wich makes it look rather clumsy with all the escaping of special characters.
Anyway, glad it helped.
Steffen
Batch file help. Needing to position windows.
Moderator: DosItHelp
Re: Batch file help. Needing to position windows.
Hi, I want to use batch file and open to specific position.
Where would the Window Gpos code fit in here?
Thanks a lot
Where would the Window Gpos code fit in here?
Thanks a lot
Code: Select all
@echo off
start "Chrome" "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1"
Re: Batch file help. Needing to position windows.
You can try tweaking Steffens code at post #14 (untested)
Code: Select all
@if (@a)==(@b) @end /*
@echo off &setlocal
set "start=cscript //nologo //e:jscript %~fs0 "
%start% "C:\Program Files\Google\Chrome\Application\chrome.exe" 0 0
goto :eof */
var objWMIService = GetObject('winmgmts:\\\\.\\root\\CIMV2'),
objProcess = objWMIService.Get('Win32_Process'),
objParam = objProcess.Methods_('Create').InParameters.SpawnInstance_(),
objStartup = objWMIService.Get('Win32_ProcessStartup').SpawnInstance_();
objStartup.X = WScript.Arguments(1);
objStartup.Y = WScript.Arguments(2);
objParam.Properties_.Item('CommandLine').Value = WScript.Arguments(0);
objParam.Properties_.Item('ProcessStartupInformation').Value = objStartup;
objWMIService.ExecMethod('Win32_Process', 'Create', objParam);
Re: Batch file help. Needing to position windows.
Sorry I don't have much technical knowledge. Is there no way I can use the window.exe program and then insert this function Window GPos x y as shown in message 8?
Re: Batch file help. Needing to position windows.
The description of Window.exe states
Since you want to target a browser window (not the console window) I'm afraid the answer is no.Window.exe Get/set several values related to console screen window.
Steffen
Re: Batch file help. Needing to position windows.
Thanks for the reply!
Do you know of anyway I might be able to do this?
Do you know of anyway I might be able to do this?