moving and resizing windows in AutoHotKey

One of the minor little issues I’ve had since this whole “work from home” thing started is that I frequently need to switch back and forth between using my laptop on its own vs. remoting into it from my desktop PC. I always need to be connected to our work VPN, and we’re not allowed to install the VPN client on personal PCs. And I don’t have an easy way to connect my personal monitor, mouse, and keyboard to the laptop. (Yes, I know there are a bunch of reasonably easy ways to do that. I just haven’t made the effort.) So I spend most of the day remoted in to the laptop via RDP from my desktop PC. But I disconnect and use the laptop directly whenever I need to be in a meeting, so I can use the camera and microphone. (And, yes, there’s probably a way for me to use the camera and mic while remoted in, but I haven’t bothered to try figuring that out either.)

Anyway, the issue with all that is that the change in resolution between the laptop screen and my desktop monitor confuses things, so my window sizes and positions are generally all screwed up when I do that. So I wanted to write a little AutoHotKey script to automatically move and resize the windows for my most commonly-used programs. (In my case: Outlook, OneNote, and Firefox. I do my actual development work via RDP into a VM, not on my “real” computer, so it’s just the productivity stuff running on the laptop.)

Of course, given the way these things tend to go, I just lived with it until June, when I finally got around to writing the script. And, again, of course, I found issues with the script, but didn’t bother correcting them until… today. So here’s a script that looks at the current monitor’s resolution, then moves and resizes Outlook, OneNote, and Firefox so they’re tiled and just the right size for my preferences.

SysGet, Mon1, Monitor
;MsgBox, screen dimensions: %Mon1Right% x %Mon1Bottom%

X := 70
Y := 32
Width := Mon1Right - 240
Height := Mon1Bottom - 150
;MsgBox, X=%X%, Y=%Y%, Width=%Width%, Height=%Height%

WinRestore, ahk_exe OUTLOOK.EXE
WinMove, ahk_exe OUTLOOK.EXE,, X, Y, Width, Height
WinRestore, ahk_exe firefox.exe
WinMove, ahk_exe firefox.exe,, X*2, Y*2, Width, Height
WinRestore, ahk_exe ONENOTE.EXE
WinMove, ahk_exe ONENOTE.EXE,, X*3, Y*3, Width, Height

Nothing fancy, but it does what I need, and I thought it might be useful to post it here. It’s using the SysGet command to get the screen dimensions, and the WinMove command to move the windows.

I also considered using PowerShell with WASP for this, but I’m more familiar with AHK.

new Lenovo laptop

The new laptop that I ordered on Sunday showed up today. It’s a Lenovo Flex 5, from Costco. I don’t have much to say about it yet. It’s about what I expected. It seems to be pretty solid, but it’s definitely from Lenovo’s consumer side rather than their business side. It’s got a touchscreen, and it can be folded all the way back so it can be used as a tablet. It didn’t come with a pen, but it appears to support pen input. I don’t know much about Windows 10’s pen support, but I might look into it, just out of curiosity.

The keyboard is okay, but not great. And the layout is sensible, but of course it’s at least slightly different from my other two current laptops (my personal MacBook Air and my work HP laptop), so I’m going to be stumbling on key locations, but that’s life. The camera works, but apparently can’t be used with Windows Hello. (That’s fine. I don’t really need that.) It’s also got a fingerprint reader that I haven’t tried to set up yet.

The laptop didn’t have too much bloatware on it. During setup, Lenovo gives you the option to install a few things that you really don’t need, so I appreciated the opportunity to decline those. I did have to uninstall two separate McAfee products though. I got a few essentials installed on it today (Evernote, 1Password, Firefox, Notepad++, and a few other things). And I got it updated to Windows 10 Pro (from Home). I’ll probably install some dev tools on it tomorrow and/or over the weekend. And maybe Steam too, so I can play some games.

I have a couple of other topics I wanted to blog about too, but they’re totally unrelated to this, so I may write them up separately later or over the weekend.

backups (and maybe upgrades)

I haven’t upgraded my MacBook Air to Catalina yet, but I might do it soon. I should probably wait for 10.15.2, really, but 10.15.1 might be good enough for me. I did a full backup with Carbon Copy Cloner today, and also ran a Time Machine backup, so I’m ready, I guess.

Between CCC and Time Machine, I’m pretty well covered on the Mac. I’ve been having trouble finding a good backup solution for my Windows 10 desktop machine though. After my problems from last last year and into early this year, I’ve been trying to find something that works well. I’ve had problems with both Macrium and Acronis, which seem to be the two best consumer-level Windows backup tools out there. I gave Arq a try, back in February, but had some issues with it and didn’t go back to it. And I gave Macrium one more try in September and couldn’t get it to work.

I do keep most of my important files in OneDrive, so I’m not really too worried about losing anything. And I have File History set up and working. (Though the drive I’m using for that is a little finicky.) So I’m mostly covered there. But I wanted to get something a bit more like a full backup going.

I tried something called Bvckup today, and it’s not exactly what I’m looking for, but it worked well, and it might be close enough. It’s more of a file sync program that a backup program, so that’s the main issue. It doesn’t create full system images, or even compressed files. It just mirrors one folder to another folder. I have it set up to copy all of the data folders from my hard drive to a second drive. I’m excluding my Windows and program folders, but including pretty much everything else. The backup ran pretty quickly, considering how much data it had to copy. It hit two errors, but reported them clearly in the log and proceeded past them without any issues. The two errors were CRC errors on a couple of fairly random PDF files. Both files were in OneDrive, so I replaced the copies on my hard drive with good copies from OneDrive.

I’m a little worried about these random errors, but I hope they’re just leftovers from the mess in November 2018 (or the related mess in January 2019). Anyway, I’m going to try to get regular backups going with Bvckup now. I’m on a two-week trial. If things work out, I’ll probably spend $50 on the pro version. I may also swap out the drive I’m using for File History with a slightly more reliable one. (Drives are cheap enough that I should be able to talk myself into dumping the slightly dodgy one…)

I’m also getting close to finally giving in and paying for a cloud backup solution. If I do that, it’ll almost definitely be Backblaze. If I were to decide to run it on both my Mac and PC, though, it’ll be fairly expensive, so I don’t know about that. I’m thinking about it though.

 

Microsoft Build

I wish I could have stayed in the Seattle area for MS Build, instead of coming back to NJ on Saturday. There have been some interesting announcements, including a new Windows terminal program, WSL 2, and .NET 5. At work, I’m still stuck using Windows 7 on my desktop and laptop, so I can’t use WSL, but I’d really like to. (At home, I have Windows 10 on my desktop and laptop, so I can use WSL at home, but I don’t have much need for it there.) Anyway, here’s hoping I can get one or both of my work machines upgraded or replaced at some point this year.

Microsoft, as expected, is pushing a lot of Azure stuff at Build. I should probably watch some videos from Build this week, but I don’t know when I can find the time for much of that. I’m already behind at work just from being away for three days last week. Maybe I can squeeze in the “All the Developer Things” clip from Scott Hanselman at some point today.

Global Azure Bootcamp and Pragmatic Programming

I’ve been doing a bunch of work related to Azure recently. It’s mostly not around actually using Azure, but rather managing Azure and billing for Azure. I’m in the middle of something right now that’s honestly driving me to distraction and making me want to take a month or two off and maybe traipse around Europe or something. Anyway, today is Global Azure Bootcamp. There’s an event here in NJ, at Microsoft’s office in Iselin, but I was too late to register for it, and it’s full up now.

There’s also a lot of online stuff going on, though. It should all get posted to this YouTube channel. I can see a bunch of stuff up there already, and it’s only 8am Eastern time. (The Auckland event is already over. I guess because it’s midnight there right now, so today is already over. Funny how that works…)

Anyway, I really want to watch a bunch of this stuff, but it’s Saturday, and the weather should be pretty nice, and yesterday’s rained out Somerset Patriots game has been rescheduled to today, and I’ve got finish my laundry, and do my grocery shopping, and so on and so forth.

Looking at what’s already on YouTube, I’m kind of interested in two of the videos from the Perth/Beijing cycle:

  1. Understanding The New Azure Role-Based Certifications – I probably don’t have the spare time to study for and pass any Azure certification exams, but a guy can dream, right?
  2. Mission: Azure Kubernetes Service – Because some other folks I’m working with have been talking about Kubernetes, and I know almost nothing about it.

I’m going to the Microsoft offices in Redmond next week for a workshop related to the specific project I’m working on, so that should be useful. But sometimes I feel like I’m really falling behind with all this Azure and AWS stuff. I’ve been reading The Pragmatic Programmer: From Journeyman to Master in my spare time recently. It’s a classic, but it’s 20 years old, so there are a lot of dated references in it. It’s actually been kind of comforting to read it. I guess I’m more at home with references to 56k modems than references to Kubernetes clusters. There’s actually a 20th anniversary version of the book coming out soon, so maybe I should give up on the old version and wait for the new one.

Stumbling Through

I’m taking a scheduled day off from work today. My original plan was to go into NYC and see the new Tolkien exhibit at the Morgan Library. But I started feeling sick earlier this week. And it started getting really cold. Yesterday started out at 1° F, with a “feels like” temp of -12°. So I called in sick yesterday. If not for the weather, I probably could have stumbled through work yesterday and even made it into New York today, but it got to be too much. Today is a little warmer. It started out at 5° (at 6am), and is now up to 14° (at 10am). But that’s still cold enough that hopping on a train to New York seemed like a bad idea. So I’m cocooned in my apartment, trying to stay warm and comfortable.

I didn’t leave the apartment at all yesterday, and spent most of the day reading comics, listening to podcasts, and watching TV. I’m being a little more productive today. I actually left the apartment (to take out the garbage), and I’m currently working through my to-do list, getting some tax stuff organized and taking care of some other miscellaneous paperwork.

I was doing a lot of stuff on my desktop PC this morning, and it had been working fine, but it decided to crash again, about a half-hour ago. I thought I was going to have to reinstall Windows again, but after a few reboots, it came back up, and has been working fine. My faith in Windows 10 in general, and this PC in particular, is getting pretty shaky. I still really don’t want to have to buy a new PC right now, but I might have to. I have other things to worry about right now, so I’m going to hope for the best. But if it keeps crashing, I’m going to have to think about either getting a new PC or maybe giving up on Windows 10 and switching my desktop machine over to a Mac Mini or something like that.

Anyway, that’s not really what I wanted to blog about today. I had a few subjects I was going to cover. First, I was going to return to my comic book indecision post from late last year. The news that St. Mark’s Comics is closing got me thinking about that again, along with a couple of articles related to the DC Universe service. (Specifically: Young Justice sounds pretty good, and the comic book library associated with DC Universe is getting bigger.) I was never actually a regular customer at St. Mark’s, but it was a pretty well-known store in NYC. I still like the idea of supporting independent brick-and-mortal comic book shops, but it’s not really practical for me to do that right now, even with the shop that’s right across the street from me.

I’m also still not ready to switch to all-digital though. I’m going to hang in there with Westfield for a few more months, at least until the end of Warren Ellis’ Wild Storm series. After that, though, I may stop buying monthly books again. I’m looking at my pile, and I see that I’m about a year behind on some of my books. So I’m probably going to need to take a break.

I had a few other things I wanted to blog about, but I should probably stop now. It’s almost 11am, and I want to actually read a few comics today too. I read Christopher Priest’s run on Justice League yesterday, and I want to try getting through maybe a dozen issues of something or other today. I still can’t decide what though. And I probably won’t make it through a dozen comics today either. I’m actually feeling like maybe it’s time for a nap now.

Yet More Windows 10 Grief

My desktop PC has been running fine since rebuilding it back in November. But today, something happened. I don’t know what exactly. I had left the PC on all day, having taken care of some bill paying and stuff in the morning.

I noticed early this evening that it seemed to be stuck in a reboot cycle, crashing every time it rebooted. Long story short, I had to use the “Reset My PC” option to reinstall Windows 10. That option lets you keep all of your files, but forces you to reinstall all of your applications. So that’s what I’ve been doing for the last few hours.

My best guess is that Windows 10 decided to install some updates during the day, when I was out, and something went awry that borked my Windows install. I haven’t seem any evidence of an actual hardware problem.

Since I’ve only just recently had to redo my setup, I still had pretty up-to-date notes and install files, so getting everything back was pretty painless. At this point, I’ve installed just about everything. It took about two hours total to reinstall Windows and all of my applications.

But I’m getting a little annoyed with Windows 10. It seems like there’s way too much that can go wrong with Windows updates these days, and there’s not really any way to control them, if you’re using a consumer version of Windows 10. I’m too deeply attached to the Windows ecosystem to be able to easily pull out and switch over to Linux, or anything like that. And I love macOS, but I can’t really go Mac-only either. (And the Mac ecosystem has its own problems.)

Anyway, here’s hoping that this box holds itself together for a while longer. After some of the expenses I’ve had over the last few months, the last thing I need would be to have to go out and buy a new Windows PC.

Windows grief, part two

TL;DR: I got through all the steps in my previous post, and now have a semi-functional Windows install.

After getting all the data off my desktop PC SSD, I re-mounted it in the PC, using a different SATA cable, and tried some stuff. The drive was still not bootable, and attempts to repair it were still completely unsuccessful. I did manage to boot from a recovery USB drive that I created via the Dell site. None of the repair options that I could run from that worked, but doing a fresh install of Windows 10 does seem to have worked. At least, it’s working so far.

I’m copying some files back to it right now, while also letting it download Windows updates. That’ll keep it busy for an hour or two. Then, I’ll see if I can reboot and install the updates. If that works, then I’ll look into copying more files back and installing some software. Getting it back to where it was will probably take all week, assuming it holds together and doesn’t start blue-screening again.

If it does keep working, then I have to say that I’m not at all sure what was wrong in the first place. It almost has to have been a software problem. It wasn’t the SATA cable, or the port. If it was either of those, I would have had more luck with it prior to the nuke & pave reinstall. There’s probably no point in speculating too much at this point. I’m just going to keep pushing forward with it, and see how far I get.

Windows grief

The SSD that I installed in my desktop PC a couple of months ago has been working fine. Up until yesterday.

I got a random blue screen error yesterday, while working on the PC. I’ll leave out most of the details, but things went downhill from there. I tried a bunch of stuff, including a chkdsk /f (which didn’t help and probably didn’t finish), SpinRite (which crashed), and various Windows 10 recovery options. Nothing worked.

And I’d recently reformatted the old drive that the SSD replaced, since the SSD was working fine. And I had deleted the old backup of that old drive, so I could make room to do a full backup of the SSD. Which I tried, but couldn’t complete. So I don’t really have a good, full, backup.

This morning, I pulled the new SSD from the desktop computer and mounted it externally on my ThinkPad. It’s been working fine there, and I’ve been copying stuff off it with no problems. Of course, the ThinkPad drive is 500GB and is about half full, while the desktop drive is 1TB and there’s about 400 GB of stuff I need to copy off of it. So I’m shuffling around some old drives so I can copy the files off of the SSD. Copying everything might take up most of the day today.

Since it looks like the drive isn’t actually dead, that probably means that either: (1) the drive cable in the PC is bad, or (2) there’s something wrong on the motherboard of the PC. It’s also possible that there’s some other weird problem that I can maybe fix by doing a full reformat of the drive and reinstall of Windows 10. But I don’t think it’s a Windows problem; if it was, SpinRite likely wouldn’t have crashed, since that’s running from a boot CD. If it’s the drive cable, that’s an easy problem to fix. If it’s a hardware problem on the motherboard, then I need to figure out if I want to try to repair an out-of-warranty Dell desktop PC or just punt and buy a new one.

So my next step, after making sure I’ve got a good copy of all the data off the drive, is to mount it back in the desktop PC, with a new drive cable, and see what happens. If it works, I’ll probably try another chkdsk /f and, if that works, then I’ll breather a sigh of relief and get on with my life, I guess.

If it doesn’t work with the new drive cable, then I’m not sure what I’m going to do. I’ll try a few hardware troubleshooting ideas, and maybe I’ll get lucky. If it’s just a bad SATA port on the motherboard, then I can just use a different one. But if I can’t figure it out, I might decide to buy myself an Intel NUC kit, and transfer the drive and (maybe) memory to it. If I do that, I’ll have to buy a Windows 10 license too, I guess, but overall it should still be more affordable than buying a whole new PC.

Blog posts like this one might not communicate a lot of useful information to anyone, by the way, but I find them to be worth writing, since they allow me to organize my thoughts more than I would otherwise do. I was listening to a podcast yesterday that mentioned rubber ducking, and I guess that’s what I’m doing here, basically. So I don’t know if this post will ever help anyone else, but it helped me.

SSD upgrade, part two

I finished my SSD upgrade last week. (Here’s part one and part zero of the SSD saga.) The bracket showed up in the mail, so I opened the case up, took out the drive cage, screwed everything together, buttoned it all back up and… it all worked. It took me a while to figure out how to orient the bracket in the cage, but once I figured that out, it was easy enough.

The old spinning hard drive is now a secondary drive, and not giving me any problems. I’ll probably reformat it soon so I can use it as a backup drive. The new SSD is working great. The machine boots faster and loads programs a lot faster.

I’m not sure why I held off on doing the SSD upgrade for so long. I know my excuse is that I was waiting for prices to come down on 1 TB SSDs, but I could have done this a year ago, and they wouldn’t have been that much more expensive, really.

Oh well. I’m hoping this upgrade will help me keep this PC usable for a few more years. I don’t want to have to replace it any time soon.