Tag: automation

  • Good Morning Berlin: Work Smarter, Not Harder!

    Good Morning Berlin: Work Smarter, Not Harder!

    Are you like me—a fan of working smarter, not harder, and squeezing every last drop of efficiency out of your day? Do you enjoy multitasking so much that even your coffee break is double-booked? If you’re nodding along, welcome to my world!

    Every morning, I log in to about 16 different tools—some online, some local—and most require separate accounts and credentials. Oh, and because most corporate networks are allergic to fun, scripting options are usually limited to PowerShell or VBScript. (If your network has no restrictions… well, you might want to rethink that. Seriously. 😅)

    But fear not! I’ve come up with a PowerShell-based solution to let your computer do the heavy lifting while you enjoy your coffee. Whether it’s logging into websites, launching mail clients, or sending a cheerful “Good Morning!” on Slack, this script automates the grind so you can focus on the important stuff.

    The code is public and open source on GitHub!

    Dependencies

    • PowerShell (because it’s the last scripting tool standing in restrictive environments)
    • KeePass 2/XC (or any password manager with auto-type functionality—no hardcoding passwords here!)

    KeePass is key to this system. It allows you to set up auto-type rules like:

    “If a window titled ‘Blah Manager’ is open, and I press Ctrl + Alt + I, enter username, press Tab, enter password, and press Enter.

    Examples of Automation

    Starting a Mail Client

    Open your mail app, wait for the login window, and let KeePass fill in the credentials.

    function start_mail_client() {
        wait_till_keepass_open
    
        $notes_running = Get-Process MAIL_CLIENT -ErrorAction SilentlyContinue
        if (-Not $notes_running) {
            Start-Process "C:\Program Files (x86)\MAIL_CLIENT\MAIL_CLIENT.exe"
        
            while(-Not $wshell.AppActivate('MAIL_CLIENT Login Window Title')) {
                $wait_counter = $wait_counter + 2
                if ($wait_counter -ge 12) {
                    $wait_counter = 0
                    return
                }
                Sleep 2
            }
            $wshell.SendKeys('{TAB}')
            $wshell.SendKeys('(^%(i))') #-> KeePass autotype keyboard shortcut, standard is $wshell.SendKeys('(^%(l))')
            Sleep 5
        }
    }

    Logging into Websites

    Launch your browser, open tabs, and log in automatically.

    function login_website() {
        $wshell.AppActivate('Edge')
        start microsoft-edge:https://some-website.com
        Sleep 5
        $wshell.SendKeys('(^%(i))') #-> KeePass autotype keyboard shortcut, standard is $wshell.SendKeys('(^%(l))')
        Sleep 9

    Messaging on Slack

    Start Slack, focus the chat window, and send a cheerful morning message to your team.

    function open_chat() {
        $wshell.AppActivate('Edge')
        start microsoft-edge:https://this-is-messenger.com
        if (is_first_start) {
            $wshell.SendKeys('(^+(l))') # -> slack keyboard to focus chat window 
            Sleep 2
            $wshell.SendKeys('Good Morning everyone! :wave: ')
            Sleep 8
            $wshell.SendKeys('{ENTER}')
            Sleep 1
        } 
        Sleep 5
    }

    Deployment Options

    Option 1: Manual

    Run the script as needed, but make sure to adjust paths (e.g., KeePass database location).

    # Name of KeePass DB
    $keepass_db_name = "SomeKeePassDatabaseName.kdbx"

    Option 2: Automatic on Startup

    Set the script to run every time you boot up by combining PowerShell with a simple VBScript.

    Dim objShell
    Set objShell = Wscript.CreateObject("WScript.Shell")
    
    objShell.Run("Path\to\Desktop\Scripts\keypresser.vbs")
    WScript.Sleep 1000
    objShell.Run("powershell -noexit -file Path\to\Desktop\Scripts\GoodMorningBerlin.ps1")
    
    Set objShell = Nothing

    Bonus: VBS-Caffeine Script ☕

    Because no one wants their computer falling asleep mid-task, this tiny VBScript toggles the Num Lock key every two minutes to keep the system awake. It’s a lifesaver for long processes.

    Dim objResult
    
    Set objShell = WScript.CreateObject("WScript.Shell")
    i = 0
    
    do while i = 0
    	objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}")
    	WScript.Sleep (120000)
    
    Loop 

    Conclusion

    This script isn’t just about convenience—it’s about reclaiming your time and starting the day on your terms. So grab your coffee, lean back, and let your PC handle the morning grind for you. ☕✨

    Get started with the code today: https://github.com/StasonJatham/good-morning-berlin