Breaking News
Max’s Cool Beans

Script to Configure Windows Desktop?

NO RATINGS
View Comments: Oldest First | Newest First | Threaded View
Page 1 / 4   >   >>
jakmal
User Rank
Rookie
Windows Script Host + Run and Place Utility
jakmal   6/3/2014 1:14:16 PM
NO RATINGS
Max,


Your requirements can be achieved through a script executed through Windows-based Script Host (you can use VBScript or JavaScript) and an additional utility called as 'Run and Place'. I personally have a setup similar to yours to create this sort of workspace:



The difference is that mine is a single monitor, while yours is made of 3 (but, I guess the principle remains the same if you can address any particular location using a pixel co-ordinate).

My js script for the above pic is as below. I just double click this file (or, right click and Open With -> Microsoft Windows-based Script Host) and the programs automatically start in the required locations. (The 'Run and Place' utility rap.exe is in the same path as cluer.exe in the paths mentioned below)

[code]

oShell = WScript.CreateObject("WScript.Shell") ;
oShell.CurrentDirectory = "G:\\Crosswords";
oShell.Run("gvim \"D:\\Dropbox\\Crosswords\\Neyartha\\Database.txt\"" ) ;
oShell.Run("\"G:\\Portables\\LibreOfficePortable\\LibreOfficeCalcPortable.exe\" \"D:\\Dropbox\\Crosswords\\Neyartha\\CrosswordClueTypes.xls\"" ) ;
oShell.CurrentDirectory = "C:\\Program\ Files\ (x86)\\Crossword\ Man\\Wordplay\ Wizard\ 1.1";
oShell.Run("wordplay.exe") ;
oShell.CurrentDirectory = "C:\\Program\ Files\ (x86)\\WordWeb";
oShell.Run("wwnotray.exe");
oShell.CurrentDirectory = "G:\\Portables\\SQLiteSpy";
oShell.Run("SQLiteSpy.exe \"D:\\Dropbox\\Crosswords\\Database\\CompilersHelp.sqlite\"");
oShell.CurrentDirectory = "C:\\Program\ Files\ (x86)\\Clue\ database";
oShell.Run("rap.exe /x=530 /y=610 /w=500 /h=560 cluer.exe");

[/code]

If you want, I can pass on a link to rap.exe. I downloaded it around 6 years back and my source seems to have disappeared (a cursory Google search doesn't lead me to the link now).

 

Max The Magnificent
User Rank
Blogger
Re: Windows Script Host + Run and Place Utility
Max The Magnificent   6/3/2014 1:50:35 PM
NO RATINGS
@jakmal: If you want, I can pass on a link to rap.exe. I downloaded it around 6 years back and my source seems to have disappeared (a cursory Google search doesn't lead me to the link now).

So long as rap.exe was a free utility that anyoner coudl download and run, then that woudl be wonderful. How big is it? Would it be possible to ZIP it up and email it to me at max@CliveMaxfield.com

Max The Magnificent
User Rank
Blogger
Re: Windows Script Host + Run and Place Utility
Max The Magnificent   6/3/2014 1:51:32 PM
NO RATINGS
@jakmal: Your requirements can be achieved through a script executed through Windows-based Script Host (you can use VBScript or JavaScript) and an additional utility called as 'Run and Place'...

You are my hero!

betajet
User Rank
CEO
Creature of habit -- to a degree
betajet   6/3/2014 3:02:56 PM
NO RATINGS
I'm a creature of habit -- to a degree.  However, I've never habituated myself to any particular GUI desktop, so I'm pretty good at switching between various versions of Windows (I like 2000, dislike NT, loathe Vista, dislike 7, won't touch 8), Macintosh, and Linux desktops.  Maybe when I have the inclination to write my own desktop I'll have something worth forming a habit around :-)

Now individual programs and programming languages are another story.  I'm definitely a creature of habit there.

[Subject line and first line refer to a stanza of Bob Dylan's "I shall be free #10".]

MeasurementBlues
User Rank
Blogger
Batch files
MeasurementBlues   6/3/2014 11:12:13 PM
NO RATINGS
@Max

I automate certain tasks such as doing quick backups by writing batch files. use a text editor and save the file with a .bat extention. For example

You could simply create some shortcuts to open the files and programs you want or copy the paths from the shortcuts and paste them into a batch file. For example


"C:\Users\mrowe\Documents\EE Times\My excel file.xlsx"

then add the next shortcut to the next thing you want to open.

You could put the batch file on your desktop or amke a shortcut to the batch file. OK you do have to open the batch file once booted, but it save hunting around for everything.

Max The Magnificent
User Rank
Blogger
Re: Batch files
Max The Magnificent   6/4/2014 9:17:35 AM
NO RATINGS
@MeasurementBlues: You could simply create some shortcuts to open the files and programs you want or copy the paths from the shortcuts and paste them into a batch file.

But that would just open the files -- not place everything where I want stuff on the screens (sad face) -- on the other hand I agree it would be a step along the way -- but I'm going to try the script stuff recommendd in an earlier comment as soon as I get a free moment.

DU00000001
User Rank
CEO
rap.exe disappeared
DU00000001   6/4/2014 11:13:28 AM
NO RATINGS
@ Max: "But that would just open the files -- not place everything where I want stuff on the screens (sad face)..."


I tried to locate rap.exe but could not find it either. An additional research revealed a tool called autosizer(.exe) that might do the trick (though it seems to know even more tricks).

As for the automatic starting: in former times (DOS x.yy) we had autoexec.bat. Now (Windoof xyz) you might remember we've got the start menu hierarchy instead - including the autostart folder. (Currently tried to locate the resp. folders on my Win 7 computer and failed. I hate these constant changes !!)

Anyway, whatever is in the autostart folder will be launched during startup. Requiring the associated files to be opened you might wish to have the beforementioned batch file with entries like:
...
cd \MyDocuments\Excel-Files
Excel "this_file.xls"
cd \MyDocuments\Notes
notepad open_issues.txt
notepad documents.txt
...
And so on.

As little as I've learned about autosizer it might be the first tool to be launched to control the window sizes and positions of the applöications launched subsequently.

What I'm not absolutely sure about is whether window sizes/ positions can only be stored as 'per application' (might require to create copies of notepad) or whether they can be associated to files opened. Some research left :)

Good luck

Max The Magnificent
User Rank
Blogger
Re: rap.exe disappeared
Max The Magnificent   6/4/2014 12:21:56 PM
NO RATINGS
@DU0000001: ...whatever is in the autostart folder will be launched during startup...

Actually, I don't want that -- I do a lot of work at home and a lot of work "on the road" -- so the first thing that happens when I boot up a machine is that it syncs itself to DropBox. This means that I want to wait for the DropBox sync to complete before I launch my script to open all the windows so as to ensure I'm looking at/editing the most recent version of the files. 

Wnderer
User Rank
CEO
Re: Batch files
Wnderer   6/4/2014 12:23:11 PM
NO RATINGS
Try NirCMD

http://www.nirsoft.net/utils/nircmd.html

Here's an example of using it to set the location of window.

http://stackoverflow.com/questions/10392620/how-can-a-batch-file-run-a-program-and-set-the-position-and-size-of-the-window/


I've called nircmd from a Python program to turn on and off monitors , but I haven't used it to set the location of a window.

Good Luck

Max The Magnificent
User Rank
Blogger
Re: Batch files
Max The Magnificent   6/4/2014 12:38:43 PM
NO RATINGS
@Wnderer: Try NirCMD...

Cool Beans -- thanks for the suggestion

Page 1 / 4   >   >>
Flash Poll
Radio
LATEST ARCHIVED BROADCAST
EE Times editor Junko Yoshida grills two executives --Rick Walker, senior product marketing manager for IoT and home automation for CSR, and Jim Reich, CTO and co-founder at Palatehome.
Like Us on Facebook

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)
EE Times on Twitter
EE Times Twitter Feed
Top Comments of the Week