Breaking News
Maxís Cool Beans

Script to Configure Windows Desktop?

NO RATINGS
View Comments: Threaded | Newest First | Oldest First
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. 

DU00000001
User Rank
CEO
Re: rap.exe disappeared
DU00000001   6/4/2014 12:44:31 PM
NO RATINGS
@Max:

Having less than full auto is never a problem ...

On the other hand you might be able to find out when synching has finished - delaying the automatic start a bit. I do not have a tool readily available but it should be doable.

Max The Magnificent
User Rank
Blogger
Re: rap.exe disappeared
Max The Magnificent   6/4/2014 12:48:45 PM
NO RATINGS
@DU00000001: Having less than full auto is never a problem...

I fear I'm growing to be a bit of a fuddy-duddy -- not the least that I don't trust computers (even though I started designing them in 1980 LOL). On the one hand I want the convenience of a "double-click" to configure my desktop -- on the other hand I want to be the one who initiates things -- maybe I just have a lust for power LOL

David Ashton
User Rank
Blogger
Re: rap.exe disappeared
David Ashton   6/4/2014 6:06:10 PM
NO RATINGS
@Max I used to be able to lock the desktop in Windows 3.11 by putting one line in the WIN.INI file.  Now everything is in the registry and even if you know exactly what to put in and where (and few people seem to) it's still a pain to change things.

This is called progress.

Max The Magnificent
User Rank
Blogger
Re: rap.exe disappeared
Max The Magnificent   6/5/2014 10:09:32 AM
NO RATINGS
@David: This is called progress.

I can imagine Sheldon on The Big Bang Theory raising an eyebrow and saying to Leonard "Sarcasm?" LOL

zeeglen
User Rank
Blogger
Power Down?
zeeglen   6/4/2014 11:14:23 PM
NO RATINGS
Max,

Not to hijack this discussion, but as a side note am curious as to what percentage of computer users power down every night vs those who unplug only when thunderstorms are in the forecast?

Maybe because I come from a vacuum tube era where power-cycle thermal stresses were huge I usually do not turn my PC off, so as to avoid thermal stress on ball-grid-array devices with no mechanical flex to them.  My PC before this current one had to have the CPU heated with a hair dryer before it would finally boot; this expanded the broken solder balls(s) to make contact to the PCB.  Once started, it remained hot enough to keep the cracked balls in contact.

Have seen several BGA problems related to thermally affected cracked solder ball joints.

Any reader opinions/experiences on reliability affected by 'leave it on' vs 'turn it off'?

Max The Magnificent
User Rank
Blogger
Re: Power Down?
Max The Magnificent   6/5/2014 10:13:11 AM
NO RATINGS
@zeeglen: ...am curious as to what percentage of computer users power down every night vs those who unplug only when thunderstorms are in the forecast?

I used to both power down and unplug everything in my office every evening, but it got to br a pain crawling around under the desk, and then I purchased a monster uninterruptable power supply that is supposed to offer protection against lightning.

So now I just power everything down each evening. Apart from anything else, I have a vauge hope that this clears anything out of the memory that didn't get cleared up as it should.

elizabethsimon
User Rank
CEO
Re: rap.exe disappeared
elizabethsimon   6/6/2014 8:12:10 PM
NO RATINGS
If you're like me, one of the reasons you don't trust computers is BECAUSE you started designing them in 1980.

 

betajet
User Rank
CEO
Re: rap.exe disappeared
betajet   6/7/2014 9:21:52 AM
NO RATINGS
I trust computers pretty much... as long as I wrote all the software :-)

Max The Magnificent
User Rank
Blogger
Re: rap.exe disappeared
Max The Magnificent   6/9/2014 9:57:38 AM
NO RATINGS
@Elizabeth: If you're like me, one of the reasons you don't trust computers is BECAUSE you started designing them in 1980...

That might be it :-)

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

MeasurementBlues
User Rank
Blogger
Re: Batch files
MeasurementBlues   6/4/2014 5:10:37 PM
NO RATINGS
@Max, and you will share this discovery with us, right?

Max The Magnificent
User Rank
Blogger
Re: Batch files
Max The Magnificent   6/4/2014 5:18:37 PM
NO RATINGS
@MeasurementBlues: ...and you will share this discovery with us, right?

I was going to say "what's it worth to you?" But then I remembered that you introduced me to the delights of the knish, so I owe you one :-)

Once I've got it sorted out, I'll post a follow-up blog explaining all.

David Ashton
User Rank
Blogger
Re: Batch files
David Ashton   6/7/2014 4:11:32 AM
NO RATINGS
@Max... "....that you introduced me to the delights of the knish"

Can you put bacon on those?

betajet
User Rank
CEO
Re: Batch files
betajet   6/7/2014 9:12:40 AM
NO RATINGS
David asked: Can you put bacon on those?

"Not in my cave", to quote Mel Brooks' 2000 Year Old Man.

[Explanation of reference available by request.]

David Ashton
User Rank
Blogger
Re: Batch files
David Ashton   6/7/2014 8:51:18 PM
NO RATINGS
@Betajet....I suspected as much....didn't know the Mel Brooks reference but Googled / YouTubed it (can you use YouTube as a verb like Google??  Well I just did.... :-) and they are pretty funny.

However the real purpose of my post was to provoke another round of potshots between Max and Measurement Blues....wait for Monday.... :-)

Max The Magnificent
User Rank
Blogger
Re: Batch files
Max The Magnificent   6/9/2014 10:00:14 AM
NO RATINGS
@David: ...the real purpose of my post was to provoke another round of potshots between Max and Measurement Blues...

Now I feel used :-)

Max The Magnificent
User Rank
Blogger
Re: Batch files
Max The Magnificent   6/9/2014 9:59:06 AM
NO RATINGS
@David: Can you put bacon on those?

I'm sure Martin Rowe (a.k.a. MeasurementBlues) -- he with all the rules as to how one should eat one's bagels -- would say no ... but what does he know? LOL

perl_geek
User Rank
CEO
Not a problem
perl_geek   6/4/2014 3:46:07 PM
NO RATINGS
Too bad you don't use Linux. When I log in, the set up, (on all 4 desktops), is exactly the same as it was when it shut down. That's standard behaviour.

Max The Magnificent
User Rank
Blogger
Re: Not a problem
Max The Magnificent   6/4/2014 4:16:19 PM
NO RATINGS
@perl_geek: Too bad you don't use Linux. When I log in, the set up, (on all 4 desktops), is exactly the same as it was when it shut down. That's standard behaviour.

Why do I get the impression you really wanted to finish up by saying "Nah Nah na Nah-naa!" LOL

perl_geek
User Rank
CEO
Re: Not a problem
perl_geek   6/5/2014 8:58:20 AM
NO RATINGS
That would  convert a simple statement of fact into an unseemly piece of gloating. :-)*

Max The Magnificent
User Rank
Blogger
Re: Not a problem
Max The Magnificent   6/5/2014 10:15:30 AM
NO RATINGS
@perl_geek: That would  convert a simple statement of fact into an unseemly piece of gloating...

LOL

Steve Manley
User Rank
Blogger
Batch File Solution
Steve Manley   6/5/2014 7:41:39 AM
NO RATINGS
Max,

You could try a batch file like this one for Notepad (obviously edditing the x&y metrics and file & path names to your requirements). Excel shouls open up in the place it was last used.

@echo off
Start Excel

reg ADD "HKCU\Software\Microsoft\Notepad" /v iWindowPosDX /t REG_DWORD /d 800 /f
reg ADD "HKCU\Software\Microsoft\Notepad" /v iWindowPosDY /t REG_DWORD /d 400 /f
reg ADD "HKCU\Software\Microsoft\Notepad" /v iWindowPosX /t REG_DWORD /d 50 /f
reg ADD "HKCU\Software\Microsoft\Notepad" /v iWindowPosY /t REG_DWORD /d 100 /f
start Notepad (path and file name of the first Notpad Doc. e.g. C:\Temp\1stNotepadfile.txt)

reg ADD "HKCU\Software\Microsoft\Notepad" /v iWindowPosDX /t REG_DWORD /d 400 /f
reg ADD "HKCU\Software\Microsoft\Notepad" /v iWindowPosDY /t REG_DWORD /d 200 /f
reg ADD "HKCU\Software\Microsoft\Notepad" /v iWindowPosX /t REG_DWORD /d 1500 /f
reg ADD "HKCU\Software\Microsoft\Notepad" /v iWindowPosY /t REG_DWORD /d 200 /f
start Notepad (path and file name of the first Notpad Doc. e.g. C:\Temp\2ndNotepadfile.txt)

Max The Magnificent
User Rank
Blogger
Re: Batch File Solution
Max The Magnificent   6/5/2014 10:14:39 AM
NO RATINGS
@Steve: You could try a batch file like this one for Notepad...

What I really need is you here to do this for me while I go and get a cup of coffee :-)

lgadz61
User Rank
Rookie
Script Utility to Configure Windows Desktop
lgadz61   6/5/2014 7:15:28 PM
NO RATINGS
I managed a bunch of desktops (2,000+) where we wanted to place applications in specific locations as you want to do including multiple monitors.  I used AutoIt for a lot of this.  Also used Windows Scripting Host but found AutoIt easier to use when you needed/wanted a windowed interface.  Last used it on Windows XP but the app will also run on Windows 7 and Windows 8 (desktop mode only).

 

Max The Magnificent
User Rank
Blogger
Re: Script Utility to Configure Windows Desktop
Max The Magnificent   6/6/2014 12:39:14 PM
NO RATINGS
@lgadz61: I used AutoIt for a lot of this.

Thanks for sharing -- I'm going to ask our IT guy to peruse and ponder all these suggestions and pick the best (I'm sure he'll appreciate me giving his something to do to fill his days LOL)

Darius Pl.
User Rank
Rookie
An alternative?
Darius Pl.   6/6/2014 6:13:32 PM
NO RATINGS

Hi Max,

 

I am not sure if my first post attempt was successful, so here I try again. I want to suggest an alternative approach to some of your problems.

 

Instead of notepads - all of your notes could be held in one OneNote window/page. Of cause it depends on the size of your notepad files if everything can be shown nicely in one OneNote window/page.

It is a quite nice tool to keep all your notes. You get instantaneous search in all your "notebooks". You can place there screenshots or document "printouts". OneNote will do OCR text recognition and this allows to search for text in all your images that are in the notes! OneNote can also use various types of tags and search only for them.

Tables, diagrams, equations (with computed answers) and other things can added to the notes!

 

OneNote used to come with some more expensive Office packages. Now there is a free version (OneNote 2013) with the limitation that the notes must be stored on OneDrive and not on your PC. OneNote works quite well with OneDrive. This allows to open the notes from any type of a mobile device or any web browser on other computer that do not have OneNote.

Check the youtube video for a quick introduction: "Microsoft OneNote for Mac Demo". This video is short and most of things also apply to the Windows version.

It may take a bit of time to get used to it, but after this I am sure you will not go back to notepad files :o)

Max The Magnificent
User Rank
Blogger
Re: An alternative?
Max The Magnificent   6/9/2014 9:56:46 AM
NO RATINGS
@Darius: Instead of notepads - all of your notes could be held in one OneNote window/page...

I'm sure you are correct ... and maybe if you were here in the office and you opened a OneNote window/page and demonstrated it I'd say "wow" ... but I'm sort of a creature of habit ... sometimes it's easier just to do things the same way ... just having a script to open all my notepad files is a big step for me LOL

Radio
NEXT UPCOMING BROADCAST
EE Times Senior Technical Editor Martin Rowe will interview EMC engineer Kenneth Wyatt.
Top Comments of the Week
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
Flash Poll