October 30, 2012

Controlling Apps that Run as Admin

Filed under: Automation,Vista,Windows 7,Windows 8 — Marcus Tettmar @ 10:16 am

By now you are probably aware of UAC (User Account Control) that came along when Vista was released. And you probably know that to do anything like copy files to Windows\System32 or Program Files or do other administrative stuff you need to be running as Admin, or you’ll get the UAC prompt come up asking you for permission to continue. And when you continue the thing you launched is then running as admin.

For sensible reasons, Windows is designed so that an ordinary level process – i.e. an application that is running under a standard user account without administrative privileges (let’s call it an un-elevated application) is not allowed to manipulate, interact with or exchange information with an elevated process (one running with administrator privileges or “As Admin”).

Macro Scheduler runs “as invoker”. In other words it runs at the level of the user who starts it. In most cases, and by default, that means it is running without administrator privileges. Unless you have disabled UAC, or chosen to run Macro Scheduler as admin, or have set the Macro Scheduler shortcut properties to launch Macro Scheduler as admin, then Macro Scheduler will run as a standard user without administrative privileges.

Since a standard process is not allowed to manipulate an admin process, Macro Scheduler is not able, by default, to send keystrokes into windows belonging to processes running as admin.

Try it. Run Notepad as admin and then try the following simple macro in Macro Scheduler:

Setfocus>Untitled – Notepad
Send>Hello World

You’ll see nothing happen. The text “Hello world” will not arrive in Notepad.

Now close Notepad and run Notepad as normal and of course the script works.

So what do you do if you NEED to send keystrokes into an admin level window? Well, unless it is possible to run that process as an ordinary user you will need to also run Macro Scheduler as admin.

To run Macro Scheduler “elevated” as admin, right click on the Macro Scheduler shortcut and select “Run as Administrator”. If you have UAC enabled (the default) you’ll see the UAC confirmation box pop up to make sure you’re happy to continue. Ok that and now Macro Scheduler is running as admin.

Now try running Notepad as admin again and you’ll find our little macro works.

Some legacy applications written before Vista came along were developed assuming the user had administrative privileges, which was common in the days of XP. This was poor practice but widely done. A common transgression was that they would write their settings and files to the Program Folder. In order to run these applications under Vista or later they would therefore have to be run as Admin, unless there was any way to force them to write data to another more sensible location. Sadly there are still applications that do this, especially older ones that are no longer maintained. Since the only way to use such legacy apps on Vista/Win7/Win8 is to disable UAC or set them to run as admin and put up with the UAC prompt, if you need to automate them you’re going to have to also run Macro Scheduler (or your compiled macro) as admin.

Short version: If you wish to automate an elevated application (one that runs as admin), Macro Scheduler or your compiled macro, also needs to be running elevated.

April 26, 2010

Windows Version Trends

Filed under: Windows 7 — Marcus Tettmar @ 10:57 am

I’ve just downloaded Windows version usage data from StatCounter and charted it in Excel, adding polynomial trend lines. Here are the results:

wintrends

If this is right Windows 7 usage will eclipse that of XP by the end of this year. But I’m no statistician so don’t hold me to that.

Either way, I understand that a lot of companies chose to skip Windows Vista and are now going straight to Windows 7. Now is definitely the time to make sure your macros run on Windows 7 if you haven’t already.

October 22, 2009

Windows 7 is Here, So Long XP!

Filed under: General,Windows 7 — Marcus Tettmar @ 9:38 am

Windows 7 Front Runner

So, unless you’ve been sleeping under a rock you’ll probably be aware that today is the day that Windows Vista gets it’s official upgrade in the form of Windows 7. We got our hands on a beta copy as soon as it became available to MSDN subscribers and back in January I was able to report that Macro Scheduler 11 is compatible with the new operating system. In fact Macro Scheduler 11 is now listed as a “Windows 7 Front Runner” application. These are applications that already support Windows 7 on launch date.

I’ve actually been running Windows 7 on my main desktop since the RTM (Release to Manufacturing) version was made available in August. It was an easy upgrade from Vista. I like it. It feels more responsive than Vista (though I have no idea if it really is) and I’ve encountered no problems. The UAC prompts that gave Vista such a bad reputation can now be manually adjusted so rather than the two options – “Off and completely insecure” or “On but potentially very annoying” – you now have a sliding scale of annoyance. Personally I never had any problems with UAC and I’ve left Windows 7 running with the default options on my main desktop.

Compared to the horribly insecure default mode of XP that allows home users to unknowingly delete system files and install trojans; UAC in Vista and Windows 7 is a godsend. The trouble with XP was that if you did try and do the sensible thing and run in a restricted user account you’d find that so many things didn’t work. It was a pain to then switch to an Administrator account in order to install some software or make a system configuration change. The problem was self perpetuating in the sense that since most users ran in the default admin mode, developers of software assumed this was the case leading to software that only worked when run under an administrator user. This in turn lead to more people running as admin and not bothering to lock down their systems.

I think pretty much every home user I know who runs XP has at some point ended up with a virus or trojan on their computer. I’ve had to come to the rescue many a time. For friends and family with children in the household I’ve always encouraged the parents to only allow their children to use a restricted account, but found that they gave up because sites and software that the children wanted to use legitimately wouldn’t work easily without first changing their account to an administrator. Not surprisingly the parent got fed up with the hassle and gave up, or forgot to set the account back to restricted, and eventually I’d be called upon to fix yet another case of weird behaviour (of the computer, not the child or parent) which turned out to be due to a virus, trojan or some other system problem brought about because as an administrator anything can happen without the user’s knowledge.

That’s why I now encourage these families to upgrade to Windows 7. When administrator privileges are required – say to install a piece of software or browser plugin – the administrator password can be entered and the job is done. They should still make sure their kids are running in ordinary accounts though, because kids will probably still click YES on every UAC box they see! As an ordinary user, if the child does something that requires administrator privileges they will need to ask their parent or whoever is the administrator to approve it and enter the administrator password if they do. Otherwise no harm can be done.

In my view UAC therefore means LESS hassle and MORE security for families and end-users than XP offered. Sure, UAC might be annoying for advanced users who make configuration changes frequently, but they could switch it off in Vista or “turn it down” in Windows 7. But for general day-to-day use I would advise against it. I’d rather know that something wants Administrator access when it tries to do something, and I can purposefully choose to start something with Admin rights when I know that I’ll need it.

When I’m not in my office I use an Asus Eee PC 1000H Netbook. It’s a nifty little lightweight machine that has only 1gb RAM and came with XP installed. The Netbook trend has been for smaller, lighter machines with a long battery life and that generally means keeping the specification simple with a basic processor and small RAM. Traditionally PCs have been going in the opposite direction with Microsoft’s operating systems getting bulkier and more demanding. So the choice for Netbooks has so far been Linux, or XP if you wanted a Microsoft OS. But we can’t keep using XP forever and Microsoft needed to make sure their new operating system ran well on Netbooks and indeed claimed that Windows 7 would support them. I was interested to find out for myself how well Windows 7 would run on my Eee PC and was keen to ditch XP anyway. I now have Windows 7 running on my Netbook and I am very pleased. It boots up quickly, appears no less responsive than before and there is no appreciable difference in battery time.

So for me Vista was an improvement and Windows 7 is the polished version. Unfortunately it’s not possible to upgrade XP to Windows 7 without doing a clean installation. I wonder if that might slow down the adoption rate, although I see that Windows 7 is the biggest pre-order item at Amazon UK, beating Harry Potter! I’m not sure what that says, but after eight long years it’s definitely time to say bye bye to Windows XP.

August 11, 2009

Windows 7 Keyboard Shortcuts

Filed under: General,Windows 7 — Marcus Tettmar @ 4:37 pm

Back in January we were able to download the Windows 7 beta and I reported that Macro Scheduler 11 is fully compatible with Windows 7. Yesterday the final RTM (Release to Manufacturing) version was made available to MSDN subscribers and so today I upgraded my Vista desktop to Windows 7.

I am pleased to report that the upgrade went painlessly. The only issue I encountered after the upgrade was lack of audio which was easily rectified with a visit to Creative’s website and a download of the updated driver for my audio device. Needless to say, Macro Scheduler is running smoothly under this shiny new interface.

Most people seem to be saying that Windows 7 is the Vista upgrade that makes Vista what it should have been. Seems pretty slick so far, but I’ll report back after I’ve been using it a while.

In the mean time here’s a full list of keyboard shortcuts in Windows 7 which may come in handy for Macro Scheduler developers.

January 15, 2009

Windows 7 Betta (sic)

Filed under: Windows 7 — Marcus Tettmar @ 4:20 pm

I’m no fish expert, so it meant nothing to me when I saw the pretty looking fish on the Windows 7 beta wallpaper.  Then I saw this CNET report.  Turns out it’s a Siamese fighting fish also known as a Betta fish, pronounced “beta”.  Presumably, therefore, it won’t be the default wallpaper in the final release?

Update: I hadn’t noticed – there are also 7 bubbles!

January 14, 2009

Windows 7 Secrets

Filed under: Windows 7 — Tags: — Marcus Tettmar @ 11:08 am

Tim Sneath has a handy post entitled “The Bumper List of Windows 7 Secrets“. If you’re testing out Windows 7 you should find it useful.

January 9, 2009

Macro Scheduler Runs In Windows 7

Filed under: Announcements,General,Macro Recorder,Windows 7 — Tags: — Marcus Tettmar @ 2:05 pm

Whenever Microsoft release a new operating system I’m always a little anxious to make sure we test Macro Scheduler on it as soon as possible and find out what, if anything, needs to be changed. I’ve been following news about Windows 7 for a while now and, reading that it was built on the same core as Vista and Windows 2008, I fully expected Macro Scheduler to run fine on it. But there’s nothing like seeing it in the flesh to be absolutely sure. So when Windows 7 Beta was made available to MSDN subscribers yesterday I didn’t waste much time in downloading it.

Installing Windows 7 into Virtual PC was nice and easy and I’m pleased to say my expectations were right – Macro Scheduler 11 runs absolutely fine.  Everything works as expected, including the macro recorder and even low level stuff like text capturing.  Here’s a screen shot of Macro Scheduler 11 running in my virtual Windows 7 environment:

Macro Scheduler in Windows 7

Macro Scheduler in Windows 7