Add Computer Name to all Window Titles

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Add Computer Name to all Window Titles

Post by Marcus Tettmar » Mon Mar 27, 2006 1:13 pm

If you ever work with multiple computers remotely you will know how easy it is to get confused and forget which computer is which. This simple little script, running on the remote computers, will add the computer name to the window title of all new windows. The script needs to run continuously, so can either be set up to run on startup in Macro Scheduler, or, probably better, compiled to an EXE file and set to start once you have connected:

Label>start
Let>WIN_USEHANDLE=0
GetActiveWindow>title,X,Y
Position>COMPUTER_NAME,title,1,p
If>p=0
Let>WIN_USEHANDLE=1
GetActiveWindow>hwnd,X,Y
LibFunc>user32,SetWindowTextA,res,hwnd,%title% %COMPUTER_NAME%
Endif
Wait>0.5
Goto>start
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts