Typical usage scenario: from a batchfile you want to open several programs, for example to set up a range of your most often used websites and windows.
- Some websites including GoogleDocs
- Squeezebox music player
- A music player
Also, I want to wake up my music server.
In some cases, I want to wait until a specific program / window is open, in other cases, I don't want to launch that same program again if the window is already open.
waitwindow <windowname> [<timeout> [<action> [<commandline>]]]
Example batch file
Some parts from two different real life batch files...
Start by loading a wallpaper.
WallX is a little wallpaper manager I wrote to handle random wallpapers on multiple monitor configurations. Of course it also works on a single monitor:-)
rem *** wallpaper
start "wallpaper" wallx load c:\googledrive\wallpapers\pk_cover_kindskisslight.jpg fade distort 10 expand 100 round keep resident
Bring up bluetooth settings to remember to switch on the headphone late at night. For this I open the settings, wait until the window is open, then wait again until it's closed.
rem *** settings
start "bluetooth settings" ms-settings:bluetooth
waitwindow "settings*" 300 openclose
Open the browser and bring up blogger, so I can edit this blog
Tip: use timeout 1 after launching every two URLs, this will keep the tabs in order, and could actually speed up loading pages (seriously). See if it affects you.
rem *** ninelizards
start "blog page" chrome --profile-directory=%ninelizards% "https://ninelizardsblog.blogspot.com/"
More browser windows. Note that I use different profiles. This one is for wattpad.
start "wattpad" chrome --profile-directory=%angeljay% "https://www.wattpad.com/myworks"
A text-to-speech tool Balabolka, and of course Grammarly. Balabolka is a sloooow loader.
start "grammarly" grammarly
start "balabolka" balabolka
waitwindow "balabolk*" 300
Ah, Excel, of course...
start "plot" c:\googledrive\plot.xlsx
waitwindow "excel*" 300
Music, maestro. First wake up the music server, then launch the player, then bring up the web page of Squeezebox LMS.
WakieWakie is a little WOL tool I wrote for waking up machines on a network.
wakiewakie.exe adapter 192.168.*.* router 192.168.0.98 server 192.168.0.6 mac xx:xx:xx:xx:xx:xx retry 1600 linger 1000 history
waitwindow "squeezeplay*" 1 ifnot squeezeplayonly.bat
waitwindow "squeezeplay*" 300
start "squeezebox lms" chrome --profile-directory="Default" "http://192.168.0.6:9000/"
OBS I only want to launch once.
waitwindow "obs*" 1 start "C:\Program Files\obs-studio\bin\64bit\obs64.exe"
And finally, some webpages related to my job, because I always have to work...
start "outlook" chrome --profile-directory="Default" "https://outlook.office.com/mail/inbox"
start "outlook" chrome --profile-directory="Default" "https://outlook.office.com/calendar/view/week"
start "google calendar" chrome --profile-directory="Default" "https://calendar.google.com/calendar/u/0/r"
start "to do" chrome --profile-directory="Default" "https://keep.google.com/u/0/#home"
You'll find all the tools I wrote myself here:
Tip: CMDOW can be used to manipulate windows, bring them to the front, activate them etc. See also here.